With this tutorial, “Getting Started with AWS and EC2 Instance” we will set up AWS EC2 instance which will cost you almost free.
Before getting started further, kindly check your AWS free tire eligibility here, https://aws.amazon.com/free/
So now, let’s jump to the tutorial and follow below simple steps to set up our first AWS EC2 Instance.
- EC2 Dashboard
- Choose AMI (Amazon Machine Image)
- Choose Instance Type
- Configure Instance
- Add Storage
- Add Tags
- Configure Security Group
- Review And Deploy
After login into AWS Console (https://aws.amazon.com) go to EC2 service. You can select it from the “Services” menu from the top left navigation or you can search it in the “Find Services” option.
Here, you can change your machine image deployment region from top right option (Ref. Image below) if you wish to deploy it to the other region then default select region.
To launch the instance, select “Launch Instance” option.
Choose AMI (Amazon Machine Image)
Select “Free tier only” to get list of free available AMI and click “Select” to select your preferred OS distribution. In our case, I’ve selected “Ubuntu Server 18.04 LTS”
You can also search for available OS or package from search bar provided.
Choose Instance type
In next step, we will select the instance type. You will have a wide range of instances to select from. In this tutorial, we will select “t2.micro” under free tier as shown in image below. Click on “Next: Configure Instance Details”.
In this step, we will configure instance configurations and its behavior. We will take a high level look of the options available:
- Number of instance: Total number of instance you want to launch with this same settings. Default is 1.
- Shutdown behavior: What AWS should do with your instance when you shut it down. Default is “Stop”, “terminate” will remove your instance with all your data.
- Enable Terminate protection: If selected, you can not terminate your instance until you turn this option off from the settings. It is very helpful to protect your data from getting terminated by accident.
Now we’ve configured basic instance. Keep all other options as it is and click on “Next: Add Storage”
Default value is based on image you selected on initial stage. You can set it as per your need. However, for free tier 30GB per instance is allowed for first year. Once you set storage size, select “General Purpose SSD” and check the box for “Delete on Termination”. By doing that you can ensure that after termination of instance, you will not get charged for the reserved storage SSD. Click on “Next: Add Tags” for the next.
Tags are useful when you are managing more instance and other AWS services and you need to segregate costing and reports. In this, we will skip this part and will cover it in other tutorial where we can see its real world use.
Configure Security Group
Next step is to configure security of our sever. We will configure SSH and HTTP protocol for our server.
- Update existing SSH rule and change “Source” to “My IP”. (only if you have static IP and don’t want anyone else to get connected via SSH)
- Add New rule, Set Type: HTTP and Source: Anywhere
- Add New rule, set Type: HTTPS and Source: Anywhere
You’ve configured basic firewall now, where visitor can access your web server from HTTP/S and only you can access it using SSH.
Review And Deploy
Click on “Launch” to deploy your first AWS EC2 instance. One popup will ask you to download key pair of your server. Important note here is, DO NOT LOSS your key pair or you will lost access to your server. Once you download key pair file, Click on “Launch Instance” to launch your instance.
In few minutes, your instance will be ready. Go to your EC2 Dashboard and copy public IP address. Open Putty or any other SSH client and use username as a “ubuntu@yourpublicipaddress” and key pair file (ppk) to login.
Congratulations!!! You just launch the first AWS EC2 Instance.
Have you ever in a situation where you lost access to your AWS EC2 instance or EBS storage? Read this article to know how to recover your data in such situation: AWS EC2: Recover data from inaccessible Instance or EBS (Storage)
Let me know if you have any question. Write it down in below comment box. Don’t forgot to check latest updates here.