How to Create EC2 Instance in AWS Step by Step
Amazon EC2 or Elastic Compute Cloud is one of the most popular services of AWS. As the name says, it provides compute capacity in the AWS Cloud.
In simple terms, EC2 lets you rent a virtual server or computer where you can host your application or data.
In this post, you will learn to create EC2 instance in AWS in a step-by-step manner.
So, Are you ready ??
Let’s go !!!
Don’t want to miss any posts from us? join us on our Facebook group, and follow us on Facebook, Twitter, LinkedIn, and Instagram. You can also subscribe to our newsletter below to not miss any updates from us.
Steps to Launch EC2 Instance in AWS
- Step 1: Log in to AWS Management Console and Open EC2
- Step 2: Click on Launch Instance
- Step 3: Choose an Amazon Machine Image (AMI)
- Step 4: Choose an Instance Type
- Step 5: Configure Instance Details
- Step 6: Add Storage
- Step 7: Add Tags
- Step 8: Configure the Security Group
- Step 9: Review and Launch
- Step 10: Create/Select a Key Pair
Step 1: Log in to AWS Management Console and Open EC2
Login to AWS Management Console and open the EC2 service.
You can either go to Services -> Compute -> EC2
or type EC2 in the search bar and hit enter. Once you see the EC2 option click on that.
This will lead you to the EC2 dashboard like below.
Step 2: Click on Launch Instance
Once you are in the EC2 dashboard, you can see a summary of all the EC2 resources in your selected region.
To Create EC2 Instance in AWS, Click Launch Instance
Note: Please select the correct region in which you would like to launch your instance before actually launching it
Suggested Read:
- Launch EC2 instance in an existing VPC using CloudFormation
- Attach an IAM Role to an EC2 Instance using CloudFormation
Step 3: Choose an Amazon Machine Image (AMI)
Once you click on Launch Instance, you will be presented with a 7-step configuration screen.
There are lots of configurations but we will only go through the necessary ones.
Let’s start with choosing an AMI.
What is AMI?
AMI or Amazon Machine Image is nothing but a pre-configured template which contains software configurations for your instance for example operating system or the application server etc.
Note: You must specify an AMI when you create your EC2 instance in AWS.
I am going with Linux 2. It is also eligible for a free tier. You can select as per your requirement.
If you are launching your instance for learning purposes, make sure to select an AMI which says free tier eligible like in the screenshot below.
Step 4: Choose an Instance Type
After selecting AMI, you will be taken to the instance type selection screen.
Instance Type is basically the selection of hardware configurations for your instance for example CPU, memory, storage, and networking capacity.
AWS provides a wide range of instance types to fit different use cases.
I am going with T2.micro because it’s free. It provides 1vCPU and 1GB of memory which is good enough for learning purposes.
Suggested Read: How to choose right instance type for your workload.
You can either review and launch with the default configuration or go ahead and configure instance details.
Let’s go to the instance details screen at least to see what it has to offer.
Step 5: Configure Instance Details
In the instance details screen, you can configure a lot of details about your instance for example-
- How many instances do you want
- VPC and subnet in which you want to launch an instance
- Assign Public Ip to an instance
- Attach an IAM role to an instance etc.
The list is really long !!!
But, don’t worry, we will only choose basic ones.
I have chosen the Number of Instances to 1 and selected the VPC and Subnet in which I wanted to launch my instance.
If you scroll down, you can see some other settings as well. But let’s ignore them as of now. But to be honest, most of them are self-explanatory.
As I said, I will leave everything as default and click on add storage
Step 6: Add Storage
As the heading says, on this screen you can either modify the root volume settings or you can add New volume if required.
I am going with default only but please feel free to tweak this as per your requirement.
Step 7: Add Tags
Tags are optional for your instance but they are always good to have.
They are basically key-value pairs which provide additional information about the instance for example Name or Environment etc.
I have used one tag which is Name = DemoInstance.
As the tag applies to Instances, volumes and network interfaces, You will notice that all of them will have the name DemoInstance
Note: You can always uncheck the checkbox against any one of them if you don’t want the tag to be applied.
Step 8: Configure the Security Group
Security Group lets you control traffic to and from your EC2 instance.
It’s basically an additional firewall provided by AWS to let you block unwanted ports or open required ports.
I have left the default security group config with only 22 ports open for SSH so that I can connect to my instance.
But, feel free to open 80 or 443 on your instance if you are planning to use your instance like a web server.
Note: Always open only the required ports
Step 9: Review and Launch
Review all your selected configurations. You can always go back and change anything you want either by clicking the previous button or directly by clicking on a specific step.
If everything seems to be good, you can click on Launch.
Step 10: Create/Select a Key Pair
On clicking launch, you will get a popup screen to select an existing key pair or create a new one.
You might wonder What is a key pair?
Well, A key pair consists of a private key(your store) and a public key(AWS store). Together they let you connect to your instance securely without any password.
To be more precise, You use the private key, instead of a password, to securely access your instances.
I will go ahead and create a new one.
Select Create a new key pair option – > name your key pair -> Download Key Pair -> Launch Instance
Note: You can also go ahead by selecting “proceed without a key pair”. But, you will not be able to SSH into your instance ever
Download key pair and click Launch Instances
You will see the status that your instance is launching below.
Scroll down the page and click on View Instances
You will see like below.
Instance state is Running. You can click on the Instance ID to see more details about your instance.
Yay, Congratulations!!!
You created your EC2 instance or virtual server in the AWS cloud 🙂
Conclusion:
In this in-depth tutorial, you learnt how to create EC2 instance in AWS step by step
I hope you enjoyed this tutorial. If you have a question, feel free to drop in a comment. I will be more than happy to answer your query.
Meanwhile, you can also –
Suggested Read:
- Understand IAM PassRole to Secure your AWS Infrastructure
- How to Create S3 Bucket using CloudFomation
- AWS S3 Storage Classes: Everything You Need to Know
- AWS SQS Standard vs FIFO Queue
- How to Create S3 Bucket Policy using CloudFomation
- Provision ACM certificate using CloudFormation
- Create SSM Parameter using CloudFormation
2 thoughts on “How to Create EC2 Instance in AWS Step by Step”
How to set email when I will use bigrock domain and my hosting is on aws please explain me .
Thanks Jai for reaching out to us.
Can you please explain your situation in details, how do you want to implement?