Creating an AWS EC2 instance and SSH into it

Agnasarp
5 min readJun 13, 2021

--

AWS EC2

https://www.youtube.com/channel/UCeTOWtTWUSu2AkpjGTQBERg

The EC2 instance is a type of virtual machine, but AWS has a lot of serverless implementations now. However, this is good enough to start learning AWS technologies. The video will also teach you to connect to the new EC2 instance using SSH via putty in Windows OS.

Step 1: Log in to AWS Management Console

As the first step, you need to log in to AWS Management Console with an IAM user using your favorite web browser. Then you will see the console as below

AWS Management Console

Step 2: Click the Launch Instance button

Now you need to search the AWS product EC2. By default the product will be there in the console if you previously searched, otherwise you don’t have to worry about it because you can use the search box by just typing ec2.

Launch Instance

EC2 has a region scope, so you should select the region first before you do anything with EC2. Please remember to select the nearest region.

Step 3: Choose an Amazon Machine Image (AMI)

Here, you have to select an AMI. Have you heard about AMI? It is an Amazon-specific implementation of famous Operating Systems. We will select Amazon Linux 2 AMI in this tutorial. It is free tier eligible, so you don’t have to pay at least a cent during the first 12 months period.

Choose an AMI

Step 4: Choose an Instance Type

Then select t2 micro as the Instance Type.

Choose an Instance Type

Step 5: Configure Instance Details

Now you have to fill in configuration details about the instance. Better to keep all default values for the first time run.

Configure Instance Details

Step 6: Add Storage Details

You can keep default values for this as well.

Storage details

Step 7: Add Tags

You can add details of the instance as key-value pair. Here, we will add the name of the instance.

Add Tags

Step 8: Configure Security Group

You can attach an existing security group for the instance, but we will create a new group and attach it to our new instance.

Configure Security Group

Step 9: Review Instance Launch

You don’t have to do anything here but can just check and review your configurations.

Review Instance Launch

Step 10: Create a Key Pair

We would have a private key of the instance to log in to it in the future. Therefore, we have to create a key pay as in the below image. Download that .pem key file and store it in a safe place. Then click on the Launch Instance button.

Create a Key Pair

Step 11: Launch Instance

As you can see, our new instance is running. These are the main steps to create a new EC2 instance using the Management Console.

Launch Instance

Now we need to have a mechanism to connect to the new instance just we have created. There are mainly two steps. You can use the EC2 Connect within the same browser and you will end up with a new browser tab. Here, we use SSH with the locally installed PuTTY tool.

Step 12: Create a .ppk Private Key

You can load the .pem private key to the PuTTYgen tool and save it as a .ppk file which can be understood by the PuTTY tool.

Create .ppk Private Key

Step 13: Load .ppk Private Key

Now you can open an SSH session with the PuTTY tool. Please go to Connection -> SSH -> Auth and browse the .ppk Private Key file for authentication. and save the session.

Load .ppk Private Key

Step 14: Create an SSH session with the private key

In the same session, provide ec2-user@public-IP-of-the-instance as the hostname. Here you need to use ec2-user as the user of the instance. Mistakenly, we have added the AMI user and got errors few times as in the video.

Open a SSH Session

Step 15: Connect to EC2 instance

If you do all steps properly, then you don’t have any concerns about connecting to the instance. If you type whoami, you will get ec2-user as the result and you can ping to www.google.com just to verify your instance has Internet access. Now you can update the instance and install additional software you want to use in your cloud solution.

Connecting to EC2 Instance

These are the main steps of creating a new EC2 instance and connecting to it using SSH via the PuTTY tool. The video will guide you in all the steps clearly. If you are willing to work with Amazon AWS as new implementations or migrating from on-premise services, it is highly recommended to start with EC2 instances. Hope you will enjoy the post and the video, we have given for working with EC2 instances. Please like and comment on the video and subscribe to our Agnasarp YouTube Channel. Feel free to comment if you have any doubt about the post. We will meet you again with a useful topic like this. Until then, bye!

Originally published at https://www.agnasarp.com on June 13, 2021.

--

--

Agnasarp

Agnasarp is a technology-focused blog that has enough information about cutting-edge technologies that you can use for your problems. Stay with us!