How to Create and Launch Your First AWS EC2 Instance

Linux TLDR
Last Updated:
Reading time: 6 minutes

At some point, everyone, particularly those in IT, will have to start their cloud journey with one of the many popular providers available, such as AWS, GCP, Azure, and more.

AWS was the pioneer in the cloud computing arena, establishing itself as the top player, while others also gained recognition as reputable providers.

It’s leading cloud provider for several compelling reasons, with two particularly noteworthy factors being its high demand and its beginner-friendly free-tier option.

Many individuals opt for the free tier but encounter challenges when trying to launch their first AWS EC2 instances, and this article aims to demonstrate just how simple it is to create and launch your first AWS EC2 instance.

How to Create and Launch an AWS EC2 Instance

To set up and deploy an AWS EC2 instance, several sequential steps need to be completed. This involves accessing the AWS dashboard, then configuring security groups and generating key pairs, and finally launching the AWS EC2 instance.

All these steps are displayed, subsequently followed by…

1. Accessing the AWS Dashboard

I assume you already have an AWS free tier account, so just log in to your AWS account, and you’ll find yourself on a dashboard that will look like the one below.

AWS Dashboard

In the above image, there are four important things to understand:

  1. Current region is the most important thing to know. Whenever you login, first check the selected region in the highlighted area. To give you a rough idea, AWS has data center all across the globe. β€œN. California” is one of them and is closest to me. You can click on it and choose the one closest to your location.
  2. Recently Visited section typically shows all the services you’ve previously used, but for a new account, it will be entirely empty.
  3. Search Area is the go-to section for newly registered users, offering a quick and easy way to immediately locate various AWS services.
  4. Services Menu will show categories of AWS services similarly to your operating system menu.

As a newcomer, you may find the β€œRecently Visited” section empty, and the β€œServices Menu” can be overwhelming, so just perform a quick search for β€œEC2” in the β€œSearch areaβ€œ.

Searching for EC2 service

After selecting β€œEC2” services from the search results, you’ll be taken to an EC2 dashboard that will look like the one below.

AWS EC2 Dashboard

As a beginner aiming to launch their first AWS EC2 instance, you can focus solely on the four key points highlighted in the image above, ignoring the rest of the other information.

  1. Ensure that your chosen region remains unchanged.
  2. The new EC2 Experience should be checked; otherwise, the old EC2 dashboard will be presented to you.
  3. Security groups allow you to control inbound and outbound port permissions.
  4. Key pairs allow you to assign the SSH public key for remote access to your AWS EC2 instance from your local system.

2. Creating a New Security Group in AWS

To begin, just click the β€œSecurity Groups” option, and you’ll be taken to the next page, as shown.

Navigating to AWS Security group section

In the β€œSecurity Group” section, you’ll come across an AWS-generated security group called β€œdefaultβ€œ. Currently, I recommend creating a new security group by clicking the button indicated with point β€œ3β€œ.

Creating a new security group in AWS

In this step, you’ll need to provide essential information for your new security group:

  1. Choose a Security Group name that aligns with your requirements.
  2. Describe the security group’s purpose in the description.
  3. The VPC is automatically detected, so no changes are required.
  4. Adding a rule will create a new blank Inbound rule.
  5. Select β€œAllow All Traffic” to enable TCP/UDP access for AWS EC2 instances associated with this security group.
  6. Specify the inbound source IP as β€œ0.0.0.0/0” to allow traffic from all sources.

After completion, click the β€œCreate security group” button in the lower right corner.

Done creating security group

You will be redirected to your newly created security group page, as shown.

Security group successfully created

Upon returning to the β€œSecurity Groups” dashboard, you’ll notice your new security group positioned above the default security group.

Checking new security group on the dashboard

3. Creating a New Key Pair in AWS

Click on the β€œKey Pairs” option in the left side menu, as shown with point β€œ1” in the following image.

AWS key pairs dashboard

Upon doing so, you will be directed to the aforementioned page, which will initially appear blank. However, from this point on, you have the option to either import a new SSH public key from your system or generate a new key pair.

If you possess a local SSH public key, I assume you can handle this step independently. For other users, just click the β€œCreate key pair” button as indicated in step β€œ3β€œ, and it will take you to the following page.

Creating a new key pair in AWS

Here, it will ask you to input essential information for your new key pairs, such as:

  1. Choose a name according to your preferences.
  2. Leave the key pair type as β€œRSAβ€œ, as it’s the default.
  3. Select the β€œ.pem” file format for the output file.
  4. Click the β€œCreate key pair” button to download your new key pair.
Do not disclose your public key (or key pairs) to anyone, as it could potentially grant them access to all AWS EC2 instances linked to that key pair.
New SSH key pair created and downloaded

The β€œ1” in the image above indicates that our new key pair has automatically downloaded, and the β€œ2” in the image indicates where you can find your new key pairs in the list.

Ensure you store your downloaded key pairs securely and avoid losing them, as AWS will not permit you to download them again.

4. Creating a New AWS EC2 Instance

Finally, it’s time to create our first AWS EC2 instances, so begin by clicking on β€œInstance” in the left-side menu, as shown in the previous image labeled β€œ3” or β€œ1” in the following.

Navigating to EC2 instance dashboard

From this point, just click the β€œLaunch Instances” button, and it will take you to the next page.

Creating AWS EC2 instances

Here, you have to fill in some necessary information for your AWS EC2 instances.

  1. Set the instance count to β€œ1” to prevent the creation of multiple instances.
  2. Assign a suitable name to your instance.
  3. Select a preconfigured AMI (Amazon Machine Image) available in the free tier; β€œUbuntu” is among the options.
  4. Double-check that the chosen AMI is eligible for the free tier.

Next, scroll down a bit for other options, as shown.

Configuring other option of AWS EC2 instances

During this step, ensure the following:

  1. The instance type is configured to be eligible for the free tier.
  2. Select the SSH key pair generated in step 3.
  3. Opt for the β€œSelect existing security group” option.
  4. Choose the security group established in step 2.
  5. Click the β€œLaunch instances” button to initiate your first AWS EC2 instances.
Important Notice

Starting February 1, 2024, AWS will begin charging approximately $0.005 per hour for all public IPv4 addresses associated (or not) with services such as EC2, RDS, EKS, and others.

The AWS Free Tier for EC2 will continue to provide 750 hours of public usage per month for the starting 12 months, and you will not incur charges for owned IPv4 addresses from Amazon BYOIP.

For monitoring, analyzing, and auditing your usage of public IPv4 addresses, refer to Public IP Insights.

Done creating EC2 instances

Great job! Your first AWS EC2 instances have been successfully created. To return to the instances dashboard, just click on the β€œView all instances” button.

Instances dashboard

Here, your instances will initially appear as β€œPendingβ€œ, but within a matter of seconds, they will transition to a β€œRunning” state, displayed in green text.

5. Connecting to the AWS EC2 Instance

To establish a connection with your AWS EC2 instances, you have the option to use the AWS native web interface or establish a connection using the IPv4 address from your local system.

To establish a connection with your AWS EC2 instances through the native web interface, simply choose the AWS EC2 instances you wish to connect to and proceed by clicking on the β€œConnect” button, as shown.

Connecting to EC2 instances from AWS native web interface

Upon clicking the β€œConnect” button, you will be directed to the β€œConnect to Instances” page.

Connecting AWS EC2 instances

From here,

  1. Ensure you are in the β€œEC2 Instance Connect” section.
  2. Select the connection type (the default is typically the first option).
  3. Take note of the username; it will auto-detect the default, but if you have created multiple users for your AWS EC2 instances in the past, specify one.
  4. Finally, click the β€œConnect” button.
Connected to AWS EC2 Instaces from AWS native web interface

Tada!!! You have successfully connected to your AWS EC2 instances from the AWS native web interface.

If you wish to establish a connection from your local machine to your AWS EC2 instance, refer to the β€œSSH Client” section.

SSH client option in EC2 instance

Here, it will ask you to assign permission to the downloaded SSH key pair during step 3.

Then ask you to specify the key pair to the ssh command with the β€œ-i” flag and assign the AWS EC2 instance username (β€œubuntu” in this case) with the provided hostname.

Let me show you each step one-by-one. First, open your terminal on the local machine where you downloaded the SSH key pair and navigate to the location where your SSH key is located (typically, its β€œ~/Downloads/β€œ).

$ cd ~/Downloads/


Navigating to the download SSH key pair location

Assign permission to this key pair.

If there are spaces in the name of the key pair, insert a backslash β€œ\” in front of each space.
$ chmod 400 My\ Primary\ SSH\ Key.pem


Assigning permission to downloaded key pair

Lastly, connect to your instances with the provided key pair, username, and hostname.

$ ssh -i "My Primary SSH Key.pem" [email protected]


Connecting to remote EC2 instance from local system

Here, you are done connecting to your AWS EC2 instance remotely from your local system.

That’s the end of this article. If you have any questions or are stuck somewhere, do let us know in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.