Creating an AWS EC2 instance and SSH into it
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
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.
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.
Step 4: Choose an Instance Type
Then select t2 micro as the 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.
Step 6: Add Storage Details
You can keep default values for this as well.
Step 7: Add Tags
You can add details of the instance as key-value pair. Here, we will add the name of the instance.
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.
Step 9: Review Instance Launch
You don’t have to do anything here but can just check and review your configurations.
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.
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.
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.
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.
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.
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.
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.