Provision a server on AWS: a step-by-step guide for the absolute beginner.
Tags: aws, beginners, cloudcomputing, tutorial
Published: 2023-07-02 17:05:26

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.

![AWS Console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25ovdwq9spoj3el80e69.png)

- Now you are in the ec2 console like the below image.

![EC2 Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eru5hgpmf4uyzb0n4ii0.png)

- 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. 

![SG Home](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/souq9vg36rodaisyeyxo.png)

- 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

![SG Filled](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3a2n9p8ducxjz736zr1v.png)

- 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. 

![SG Inbound](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8m0sx10owpywogkmkrp.png)

- Now go to the Security Group dashboard and rename the Security Group name as below for better recognition. 

![SG Rename](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0han0ve48q3bvkjhjdi5.png)

- 
**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._

![Key Pair](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqo23zt8diw821shi9uw.png)

-  **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. 

![Ec2 name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95jl214ia0nhwshfogm7.png)

- From Application and OS Images usually called AMI(Amazon Machine Image) select Ubuntu Server 22.04 which one is Free tier eligible. 

![AMI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2jo8xw1kjcmaew9soys.png)


- **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.

![SSH client](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grh3d7gu2aqrxuiz2w57.png)


Following this instruction you will able to log in to your server from your local machine.