Are you a beginner and don't know how to connect to an EC2 instance through the terminal on a Windows operating system?
In this blog, I will provide step-by-step instructions on how to connect through Windows PowerShell.
Step 1: Create an Ec2 instance with Your Preferred Operating System(OS) Name, key pair , instance type.
Step 2:Wait for a while until you see the instance state is running.
Step 3:Go to the terminal and use the following command to connect to the EC2 instance.
ssh -i "key_pair.pem" ubuntu@ec2-18-60-91-82.ap-south-2.compute.amazonaws.com
Step 4:Make sure that your key pair file (private key) is in the same directory you are using.
Step 5: Navigate to the directory containing the PEM file.
Step 6:Now use this command
ssh -i "key_pair.pem" ubuntu@ec2-18-60-91-82.ap-south-2.compute.amazonaws.com
Step 7:Trying to SSH into our AWS instance, I get "bad permissions" every time. The AWS documentation gives a simple solution, which is to change the pem file permissions using chmod. But my local machine is Windows, and in the Windows world, there is no chmod to change file permissions.
Step 8:Open file properties
- Disable inheritance
Remove permissions from SYSTEM, ADMINISTRATOR, AUTHENTICATED USERS and everyone else who is not the current user (me).
Grant full control permissions to the current user (me)
Step 9: Make the file a read-only file.
-
Step 10:Now again, give the command to connect.
-
Success, you are now connected to aws ec2 instance through your windows terminal..
Subscribe to my newsletter
Read articles from Veera Venkata Lakshmi Ramisetti directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by