Connecting to Linux EC2 Instances via SSH

Noor Fatima - Jul 19 - - Dev Community

Connecting to your Amazon EC2 Linux instances via SSH is a fundamental skill for managing your cloud infrastructure. Here's a straightforward guide to help you get started with SSH access using Terminal (Mac/Linux) and PowerShell (Windows).

Using SSH with Terminal (Mac/Linux)

1. Open Terminal

Launch the Terminal application from your applications menu or by searching for it.

2. Run the SSH Command

Execute the following command to connect to your EC2 instance:

ssh -i /path/to/your-key.pem ec2-user@your-ec2-public-dns

Enter fullscreen mode Exit fullscreen mode
  • Replace /path/to/your-key.pem with the path to your private key file.
  • Replace your-ec2-public-dns with the public DNS of your EC2 instance.

3. Key Permissions

Ensure your private key file has the correct permissions. You may need to set the permissions using:

chmod 400 /path/to/your-key.pem

Enter fullscreen mode Exit fullscreen mode

Using SSH with PowerShell (Windows)

1. Open PowerShell

Open PowerShell from the Start menu or by searching for it.

2. Run the SSH Command

Execute the following command:

ssh -i C:\path\to\your-key.pem ec2-user@your-ec2-public-dns

Enter fullscreen mode Exit fullscreen mode
  • Replace C:\path\to\your-key.pem with the path to your private key file.
  • Replace your-ec2-public-dns with your EC2 instance’s public DNS.
. . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player