How to SHH into an AWS EC2 instance?
February 01, 2025 | 05:00 PM
A straightforward, step-by-step note on SSH’ing into an AWS EC2 instance using a key pair. It covers why file permissions matter for .pem keys, how to connect using either a public IPv4 address or DNS, and serves as a practical reference for getting terminal access to a remote Ubuntu server.
The SSH protocol is a network protocol operating network services securely over an unsecured network. In simple terms, it's used to connect to remote machine.
While creating an EC2 instance, keep in mind to download key pair in .pem file. The key value pair will be required to connect to the remote EC2 instance from your terminal.
The following commands will work only for EC2 with Ubuntu installed.
Step 1: Remove write and execute permissions from Instance.pem file.
chmod 400 Instance2.pem Now, copy the public IPv4 address of the EC2 instance from the AWS console.
Step 2: SSH into the remote instance by running the following command.
ssh -i Instance2.pem ubuntu@13.60.34.250Alternatively you can also use the public IPv4 DNS assigned to the instance.
ssh -i Instance2.pem ubuntu@ec2-13-60-34-250.eu-north-1.compute.amazonaws.comAnd you are in :
