Amazon Elastic Compute Cloud (EC2) is a service that provides virtual servers on the AWS cloud. Without further ado, we will provision an EC2 server following these step-by-step instructions.
Launch an EC2 instance from AWS Management Console.
Log in to your AWS management console using your root or IAM account. Using IAM with administrator access is recommended for this tutorial.
After logging in to the console from the top search bar search EC2 then click EC2 like the image below.
- Now you are in the ec2 console like the below image.
- From the left sidebar select Security Group.
A Security Group in AWS is a virtual firewall that controls inbound and outbound traffic for instances. It acts as a filter for network traffic, allowing only specified connections while blocking others.
- Now we are gonna create a custom security group for our server allowing SSH, HTTP, and HTTPS Ports: First, give a Security Group Name. In this case: MyNodejsSG
- To allow SSH access, create a new inbound rule and specify the Type SSH and Source Type Anywhere-IPv4. Similarly create HTTP and HTTPs rules.
- Now go to the Security Group dashboard and rename the Security Group name as below for better recognition.
- Key Pair:
Key pairs in AWS are used for secure SSH (Secure Shell) access to EC2 instances. They consist of a public key that is stored on the instance and a private key that is kept securely by the user, allowing for secure authentication and data encryption.
Create a key pair like this image and save this on your local machine for later use.
- Launch EC2 instance:
Instances in AWS are virtual servers that can be launched and terminated on demand. They provide scalable computing resources and can be configured with various operating systems and applications. Now we are going to create a Ubuntu 22.04 server.
- Click the Launch Instance button from your EC2 dashboard. Then give a name of your instance. I named it MyNodejsWebServer.
- From Application and OS Images usually called AMI(Amazon Machine Image) select Ubuntu Server 22.04 which one is Free tier eligible.
Instance type: t2.micro (free tier eligible)
Key pair (login): Select my_node_js_server_key from the dropdown menu that we created earlier.
Configure storage: keep it default 8 GiB gp3 root volume.
And keep everything default for now then click the Launch Instance Button from the bottom.
In a minute your instance will be running.
After successfully running your instances click on the instance id (you can find your instance id from ec2 dashboard > instances)
Log in to the server:
By clicking the instance id you find details about your instance. From here copy your public IPv4 DNS id or Public IPv4 address for later use.
Below your instances summary click CONNECT button then go to the SSH Client tab. You will find instructions like this.
Following this instruction you will able to log in to your server from your local machine.
Top comments (0)