• Monil Singhal

Launching an EC2 instance on AWS

In order to be able to host your web application, you will need a hosting solution. You can easily get started with AWS and commission an EC2 instance to be able to host your web application.

Step 1 : Create a AWS Free Tier Account

AWS provides 1-year access to Free Tier Program which can allow you to play around with various services free of charge. For this just register with a new email address and you are good to go.

  1. Go to https://console.aws.amazon.com/

  2. Click on Create New Account and sign up with a new email address.

  3. Choose account type as personal and provide the required details.

  4. Login with the newly created account


Step 2 : Choose appropriate AWS Region

AWS offers various regions which suite the availability and connectivity. For best results, choose the region nearest to your target audience. However, please note that some services are not available in all the regions. On the other hand, some services (like S3) are not region based - i.e. they are available in all the regions. For our demo purpose, I am going to choose Asia Pacific (Mumbai) region. To select the region, click on the region dropdown on the top right menu, and choose appropriate region.


Step 3 : Launch an EC2 Instance through the Launch Wizard

  1. To launch the wizard to create EC2 Instance, Go to EC2 Dashboard (Services > EC2) and click Launch Instance Button

  2. Select the AMI (Amazon Machine Image) that best suits your softwares to be installed. For this demo, I am choosing Amazon Linux 2 AMI with 64-bit (x86).

  3. Select the Instance Type based on your requirement. For the purpose of testing and a small application, the Free-Tier Eligible t2.micro can serve most purposes, which we are going to choose for the demo. After selecting the instance type click "Next:Configure Instance Details"

  4. In the network tab, you can either leave the default VPC selected or if you have need of any private cloud network, then you can choose or create your own VPC. After making the selections, click "Next: Add Storage".

  5. For usual practice purpose, the default selection of 8 GB is about enough and we really don't need to change anything here. After ensuring the size of your storage, click "Next: Add Tags"

  6. Tagging helps managing resources and services being used and trying to make a sense of them. Unless you have a requirement to manage large resource, you can leave the tags empty for now. To move on, click "Next: Configure Security Group".

  7. For the security group, we are going to let the wizard create a new security group for us which we can customize specifically for this EC2 instance. By default SSH access is allowed from all the ports, but if you have dedicated IP or use a VPN, you can specify your IP in the Security Group Rules. After setting the required access rules, click Review and Launch

  8. After reviewing the details, click "Launch".

  9. To be able to connect to your EC2 instance via SSH, a public private key must be provided at the time of creating the instance itself. This cannot be changed later so make sure to select only the accessible option. If you already have a key pair created from AWS, you can choose that from the list, or simply create a new one. If you create new key, make sure to save the private key properly because it cannot be retrieved if lost. Furthermore, the EC2 Instance after launch cannot be changed to use a different key pair.


Step 4 : Connect through SSH

On the EC2 Dashboard page, you can see all your EC2 instances and their states. After your EC2 Instance has booted up, you can connect to the instance using ssh. You will need the public IP of your EC2 instance, which is visible in the bottom details section of the EC2 instance list page (after selecting your instance).

For Linux/MacOS, SSH is already present in the terminal. For Windows, you can use Git Bash.

ssh -i <path to private key file> ec2-user@<ip address of the instance>





50 views

©2020 by CODING by Monil