01 / 03

How to connect to an EC2 instance using SSH?

SSH Connection Process

Connecting via SSH is the standard method for managing Linux-based EC2 instances. You must have the private key (.pem file) generated during instance creation to authenticate securely.

SSH Command
Requirements
  1. 1

    Ensure your private key file has restricted permissions (chmod 400).

  2. 2

    The instance must have a public IP or be accessible via a bastion host.

  3. 3

    Port 22 must be open in the associated Security Group.

  4. 4

    Use the appropriate user for your AMI (e.g., ec2-user, ubuntu, admin).