In this article, I have shown how to connect to your EC2 Linux instance from windows. If you are someone new to AWS then check out this article on what is AWS and what solutions do they offer.
Prerequisites
- Download putty and putty gen in your windows machine.
How to download putty and putty gen
- Click on the following link to download putty and putty gen.
- https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Create an EC2 Linux instance using AWS console
- After logging in into your AWS account. Open the EC2 console page by searching in the search bar.
- Click on “Instances” on the left side panel and click on “Launch instances” at the right side.
- Step 1: Select “Amazon Linux 2 AMI” (Free tier).
- Step 2: Choose an Instance Type, select t2.micro. Click Configure Instance Details. (Can also click Review and Launch for default configurations)
- Step 3: Here we can select how many instance you want to run. Also configurations like Network, subnet, Shutdown behaviour all can be setup here.
- Step 4: Used to add storage volumes like EBS and instance store. By default 8 GB Ram, general purpose SSD is given.
- Step 5: We can add tags here for referring the instance in future. It is a case sensitive key value pair.
- Step 6: The most important step as far as security is concern. By default SSH is enabled at port 22. We can also add HTTP or HTTPS for webservers.
- Step 7: Review and click launch.
- Create a new key value pair and download the .pem file in your local machine.
- Your EC2 Linux instance is successfully created.
- Go to your instance and note down the public ip of it.
Putty Configurations
- Open puttygen.exe file.
- Click load and open the key value pair file we downloaded above.
- Click Save private key (converting pem to ppk file).
- Save the ppk file on your local machine.
- Open putty.exe file.
- Enter hostname as – ec2-user@0.00.00.00 (enter your public ip in place of 0’s).
- Copy it and paste in under Saved sessions in order to use it next you log in.
- Click on SSH under Connection on left side and select Auth. (Connection = > SSH =>Auth)
- Click browse and load the ppk file that we generated.
- Click on session again and click open. Click yes if prompted with putty security alert.
Now we have successfully SSH into Linux instance from our windows machine. Use the command “whoami” to verify that you have logged in.
Happy Programming!!
1 thought on “How to SSH into AWS EC2 Linux instance from your Windows machine”