Create an EC2 instance on AWS

EC2 instance is a virtual server in AWS language, where we can run our applications. We can choose our flavour of operating system like linux, windows. It is a web service where an AWS subscriber can request and provision a compute server in AWS cloud. AWS provides multiple instance types for the respective business needs of the user.

Security Group is used to allow the inbound traffic on the server, by default everything is disallow in inbound rules and everything is allowed in outbound rules. So, be careful when we are allowing the traffic or user for access.

Prerequisites to create an EC2 instance:-
Security Group
Instance type

In the previous blog, I explained about “How to create VPC and subnets“. So, we are using same VPC and subnet here to create an EC2 Instance.

Now we are going to create an instance, click on services and select EC2 service.

Now click on instances, left side of the screen then you will this screen.

Now click on launch instance then you will see this screen select the OS like we are going to work on CentOS 7.

select the AMI (Amazon Machine Image) like we are going to work on CentOS 7 so tab on “AWS marketplace” and search CentOS 7 image and select that.

Now select the instance type as per the requirement, Click on continue

Presently we are going to use free tier instance type t2.micro, select that type and click on next. It’s our requirement which instance type we require for our projects like 4core and 16GB ram.

Now provides the configuration details:

Define the details:

No. of instances = 1 (we can define as per the requirement how many instances we want)
Network = Select the VPC in which you want to create an instance
Subnet = Select the subnet in which you want to create
Placement group = Placement Groups are logical groupings or clusters of instances in the selected AWS region
Capacity Reservation = Capacity Reservations enable you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration.
IAM Role = Through roles we can assign permissions to the instance (like fetch data from s3 bucket)
Enable Termination Protection = Always enable it because it protects from accidental termination

After defining these details click on next(add storage)

After click on that you will see this screen and see the button of ”ADD NEW VOLUME” if you want to add more storage you can add or increase the volume size like 30GB instead to add another disk but we are going with same. Now click on next(ADD TAGS)

Now, you will see this image

Define the appropriate name of the instance, which is easy to identify and recall.

Now click on next (Configure security Group). Then you will this screen

Create a new security group or select an existing security group. Now we are going to create new security group. Define the name and description and we add some more rules for http and allow the worldwide traffic.
Note:- We are assigning worldwide ssh access, but its not recommended always give ssh access to minimal users.

Type = HTTP

Source = (In this we define the traffic, custom, anywhere or my ip)

Now click on Review and Launch and then you will see this image

And now click on Launch and you will see this image

We need to create or select an existing key pairs and we are going to create new key pair. Select a new key pair option and give the key pair name.

After this click on download key pair, because it is necessary for us to login into an instance. Be careful don’t loose the pem file because if you loose you will be in trouble.

Now you will see the downloaded file with extension of .pem(EMT-TOK.pem) Now click on Launch instances and finally your instance is created.

Now you can see your instance is ready.


If you want to learn “How to create VPC and Subnets” please click on the link given below:-


1 thought on “Create an EC2 instance on AWS”

Leave a Reply

Your email address will not be published. Required fields are marked *