Amazon EC2

How to create EC2 instance?

By Abhinay Durishetty
6 mins read
With the brief introduction to AWS EC2 instances provided in the previous section, it's time to roll up our sleeves and gain some hands-on experience. Let's dive right into creating our very own EC2 instance!

To make the learning process easy and effective, we'll start by creating a simple EC2 instance with default settings for Networking, Storage, and Security Groups. This hands-on experience will help you launch an EC2 instance quickly.

In the upcoming sections, we'll dive deeper into the customization of EC2 instances. You'll learn how to configure your EC2 instances to suit your specific needs by setting up custom options for Networking, Storage, and Security Groups.

The below image depicts an EC2 instance launched in Public Network of a VPC, with an EBS Storage attached.
So, let's get started with the fundamentals and gradually explore advanced configurations to unlock the full potential of AWS EC2!



Step 1: Sign In to AWS

Log in to your AWS Management Console (https://aws.amazon.com/console/) using your AWS account credentials.

From the AWS Management Console, locate the "Services" dropdown and select "EC2" under the "Compute" section.

Step 2: Launch an Instance

In the EC2 Dashboard, click the "Instances" link in the left navigation pane, then click the orange "Launch Instance" button.

Step 3: Choose an Amazon Machine Image (AMI)

  • Give a name to your instance.
  • Choose an AMI that matches your requirements.
AMIs are pre-configured templates that include an operating system and other software. Most of the world's servers use Linux because it's open-source, reliable, and efficient. It's commonly used for web servers, databases, and more. For this guide, we'll choose a Linux AMI.
Step 4: Choose an Instance Type

  • Give a name to your instance.
  • Choose an AMI that matches your requirements.
AMIs are pre-configured templates that include an operating system and other software. Most of the world's servers use Linux because it's open-source, reliable, and efficient. It's commonly used for web servers, databases, and more. For this guide, we'll choose a Linux AMI.
Step 5: Create or Select a Key Pair

You need a key pair to securely connect to your instance using SSH. Create a new key pair or select an existing one. Make sure to safely store the private key file, as it's the key to accessing your server. If you lose it, you won't be able to access the instance. You can add other key pairs later if needed.

  • Select create a new key pair and give a name to your .pem key.
  • Click on the “Create key pair” orange button.
A .pem key will get downloaded into your local computer.
Step 6: Configure Network Details

Here, you can choose the network settings (like the VPC and subnet), and more. For now, we'll use the default VPC and subnet. Think of VPC as a private network, and we'll dive deeper into it later.

Step 7: Configure Security Group

Security groups act as virtual firewalls for your instance. Define inbound and outbound rules to control network traffic. For now, use the default security group. We can delve deeper into it later on how we use security groups for security.
Step 8: Add Storage

Configure the amount and type of storage for your instance. You can add additional storage volumes if needed.
Step 9: Review and Launch

Review your instance configuration settings. If everything looks good, click the "Launch" button.

Step 10: Launch Status

As you delve deeper into the EC2 service, you will gradually grasp and gain insights into additional settings, expanding your understanding and knowledge over time.


  • Once you click "Launch," your instance will start launching. You'll see its status change to "running" in the EC2 Dashboard.
Step 11: Access Your Instance using "ssh"

Once your instance is running, go to the EC2 Dashboard, select your instance, and click the "Connect" button. You'll find instructions for both Linux and Windows connections below:

Connecting from Mac and Linux:

  • Open a terminal on your local machine.
  • Navigate to the directory where you saved your private key file (.pem).
  • Use the "chmod" command to set the appropriate permissions on the key file:
chmod 400 <your-key-file>.pem.

  • Copy the SSH command from the EC2 instance connect page.
  • Paste the command into your terminal and press Enter

Connecting from Windows:

  • Download and install an SSH client such as PuTTY.
  • Convert your .pem key file to a .ppk key file using PuTTYgen.
  • Open PuTTY and enter the public IP address of your instance in the "Host Name" field.
  • Load your .ppk key file in the "Connection > SSH > Auth" settings.
  • Click "Open" to start the SSH session.

Step 13: Access Your Instance using "AWS Session Manager"
You can access now the instance through the AWS console using Session Manager.

This provides a browser-based session similar to EC2 Instance Connect, eliminating the need to open port 22.
Congratulations on successfully creating your EC2 instance by following the step-by-step screenshots! You're now ready to dive into the world of AWS.

If you encounter any issues while connecting to your EC2 instance, don't worry. We've got you covered! Check out the EC2 Troubleshooting section in this tutorial for guidance on resolving common issues.

Now, it's time to have some fun with your new instance! Enjoy exploring AWS and all the exciting possibilities it offers!