How to Create EC2 Instance in AWS Step by Step
In simple terms, EC2 lets you rent 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 !!!
Step 1: Login to AWS Mangement Console and Open EC2
Login to AWS Management Console and open EC2 service.
You can either go to Services -> Compute -> EC2
or type EC2 in the search bar and hit enter. Once you see EC2 option click on that.
This will lead you to EC2 dashboard like below.
Step 2: Click on Launch Instance
Once you are in EC2 dashboard, you can see 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
- 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 lot’s of configurations but we will only go through the necessary one’s .
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 free tier. You can select as per your requirement.
If you are launching your instance for learning purpose, 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 instance type selection screen.
Instance Type is basically selection of hardware configurations for your instance for example CPU, memory, storage, and networking capacity.
AWS provides wide range of instance types to fit in different use cases.
I am going with T2.micro because it’s free. It provides 1vCPU and 1GB memory which is good enough for learning purpose.
Suggested Read: How to choose right instance type for your workload.
You can either review and launch with default configuration or go ahead and configure instance details.
Let’s go to instance details screen at least to see what it has to offer.
Step 5: Configure Instance Details
In instance details screen, you can configure a lot of details about your instance for example-
- How many instance you want
- VPC and subnet in which you want to launch an instance
- Assign Public Ip to 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 Number of Instance 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, in 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 provides additional information about the instance for example Name or Environment etc.
I have used one tag which is Name = DemoInstance.
As tag applies to Instance , volumes and network interfaces, You will notice that all of them will have name DemoInstance
Note: You can always uncheck the checkbox against any one of them if you don’t want tag to be applied.
Step 8: Configure Security Group
Security Group let’s 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 to open required ports.
I have left the default security group config with only 22 port 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 planing to use your instance like web server.
Note: Always open only 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 previous button or directly by clicking on 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(you 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 keypair and click Launch Instances
You will see status like your instance is launching like 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.
Yayyy , Congratulations!!!
You created your EC2 instance or virtual server in AWS cloud 🙂
In this in depth tutorial, I walked you though creation of EC2 instance using AWS console in a step by step manner.
I hope you enjoyed this tutorial. If you have a question, feel free to drop in comment. I will be more then happy to answer your query.
Meanwhile you can also –
- 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