How to Launch an Amazon EC2 instance

Rishikesh Varvade
5 min readFeb 13, 2021

What is AWS EC2?

Elastic Compute Cloud (EC2) provides us with scalable computing capacity in Amazon Web Service (AWS) cloud. In simple words you get a cloud platform to develop and deploy your applications faster without the need of initial hardware setup.

EC2 instances are highly available and highly scalable according to our requirements. And we can configure the storage, security and networking of any EC2 instance.

In the article, we will see the requirements to launch an EC2 instance and it’s set up configurations.

Firstly to launch an EC2 instance we need to choose an Amazon Machine Image (AMI). Now what’s an AMI?

AMI is nothing but a template that contains the software configuration (operating system, application server, and applications) required to launch your instance. You can select an AMI provided by AWS , their user community, or the AWS Marketplace; or we can select one of our own AMIs.

Now let’s go through the steps to launch an EC2 instance using AWS console.

  1. Login to AWS console and navigate to ‘EC2’.

2. In the navigation pane, click ‘Instances’ and click ‘Launch Instance’.

Launching the Instance

3. Now we will select an AMI from the list which contains Linux, MacOS, Windows, Red Hat, Ubuntu AMI’s and many more options. For this tutorial I will select Amazon Linux 2 AMI.

Choose AMI for the Instance

4. Now we get to choose a Instance set from whole set of list of Instance types.

Credits: https://medium.com/faun/ec2-instance-types-comparison-and-how-to-remember-them-e0a7eb34b5de

The above diagram will give you a basic idea of how to select an Instance type according to your needs. I will be selecting a free tier which is t2.micro.

Choosing the Instance type

5. Now this is very important step where we configure the instance. We need to decide whether the instance we will public or private based on the public or private subnet we attach to the EC2 instance.

Configuring Instance Details

I will launch a public EC2 instance and hence will select the VPC and public subnet for configuration. We get the following options for configuring the EC2. There are many things to configure but these are the important options to consider.

  • Number of Instances: Number of Instances you wish to launch (by default it’s 1).
  • Network: Select the VPC under which you want to launch the EC2.
  • Subnet: Choose public subnet if you want your EC2 to be internet facing or else choose private subnet.
  • Auto-assign Public IP: You can select Use subnet setting, Enable or Disable.
  • IAM Role
  • Shutdown behavior: Specify the instance behavior when an OS-level shutdown is performed. You get two options to choose from: Stop or Terminate.
  • Enable termination protection: It helps preventing from accidental termination of your EC2 instance.
  • Monitoring: Monitor, collect, and analyze instance metrics through Amazon CloudWatch.
  • Tenancy: By default your Instance will be in a shared hardware but you can launch instance on physical servers fully dedicated for your use.

After configuring click on ‘Add Storage’

Configuring Instance Details

6. Now we need to select the storage type for our EC2 instance. We get the following options to choose from.

Credits: https://www.slideshare.net/AmazonWebServices/best-practices-running-sql-server-on-aws

You have to select the storage according to your application requirements which will be residing inside your EC2 instance. Now keep in mind that you won’t be able to choose Throughput Optimized HDD(st1) and Cold HDD(sc1) for root volume.

Selecting appropriate volume type for root

But when you attach additional volume to your Instance you get to choose those storage options here.

Attaching additional EBS volume is required

Additionally to make your storage secure you can encrypt your storage at the time of creation using AWS Key Management Service (AWS KMS) or do it later after creation as well. This feature was not available for root volume at the time of creation, but now we can encrypt the root volumes too.

Encryption of storage using AWS KMS

After this click on ‘Add Tags’.

7. Add the tags you want for your EC2 instance. And click on ‘Next: Configure Security Group’.

Tagging the Instance

8. Now configure the Security Group using the following:

  • Assign a security group: Either create new or select an existing security group
  • Security Group Name
  • Description
  • Rules for your Security Group
Configuring the Security Group

For more secure network I will be opening SSH port 22 only through My IP to connect to the EC2 instance. You can also choose Custom IP or keep it open to the world by selecting Anywhere option from the source dropdown.

Now click on Review and Launch and here you can review the EC2 instance configuration for final time and edit to change some configurations.

Final Review and Launch Instance

After reviewing carefully click on ‘Launch’. Now you need to create a key pair which is nothing but consisting of a private key and a public key, it is a set of security credentials that you use to prove your identity when connecting to an instance.

Provisioning Key for future access to Instance

Make sure to download the Key Pair before clicking on ‘Launch Instances’. You will always need the key pair to access your EC2 instance so make sure to store it at a safe place.

You will be able to see the following once you launch an instance.

EC2 Instance Dashboard and Status Checks

It will take a few minutes to initialize the Instance. Meanwhile you will be able to see all configurations in ‘Description’ like: Instance ID, IPv4 Public IP, VPC ID, Security groups attached to the instance, AMI ID, IAM Role, Subnet ID etc.

So, this is how you can create your own EC2 instance with few simple steps. I hope this article helped you with your search.

Happy Clouding!

--

--