Connect to Amazon Linux Instance

Connecting to Your Amazon Linux Instance

ℹ️ Information: In this section, you’ll learn how to connect to your Amazon Linux instance using SSH. We’ll cover two popular methods: using MobaXterm and using PuTTY on Windows.

Connect Using MobaXterm

  1. Download MobaXterm from the official website

    Download MobaXterm

  2. After downloading MobaXterm, extract and open it. Then, select Session

    Open MobaXterm and select Session

  3. In the Session settings interface, choose SSH

    Select SSH protocol

  4. Configure the SSH connection with the following details:

    • Remote host: Enter the Public IPv4 address of your instance
    • Specify username: Enter ec2-user
    • Use private key: Browse and select the key pair file (kp-linux.pem) you downloaded when creating the EC2 instance

    Configure SSH connection details

  5. Click OK to establish the connection. When successful, you’ll see the Linux terminal:

    Successful connection to Amazon Linux

💡 Pro Tip: MobaXterm provides an integrated SFTP browser on the left side of the window, allowing you to easily transfer files between your local machine and the EC2 instance.

Connect Using PuTTY

ℹ️ Information: PuTTY is a popular SSH client for Windows. Since PuTTY doesn’t natively support the .pem key format used by AWS, you’ll need to convert your key using PuTTYgen.

  1. Download the following PuTTY tools and save them to the same location as your EC2 key pair:

  2. Convert your .pem key to PuTTY format:

    • Launch puttygen.exe
    • Click Load to import your private key file

    Launch PuTTYgen

  3. Select the kp-linux.pem file you downloaded when creating your Amazon Linux instance

    Select PEM key file

  4. After successfully importing the key, click Save private key

    Save the converted key

  5. Name the key file kp-linux.ppk and click Save

    Name and save the PPK file

  6. Retrieve your instance’s public IP address:

    • Return to the EC2 console
    • Select your Linux-instance
    • Copy the Public IPv4 address

    Copy the instance’s public IP address

  7. Configure PuTTY for the connection:

    • Launch putty.exe
    • In the Host Name field, paste the Public IPv4 address
    • Enter a name (e.g., Linux-Server) in the Saved Sessions field and click Save

    Configure PuTTY session

  8. Configure SSH authentication:

    • In the category tree on the left, navigate to Connection > SSH > Auth > Credentials
    • Under Private key file for authentication, click Browse and select your kp-linux.ppk file
    • Return to the Session category and click Save to update your saved session
    • Click Open to start the connection

    Configure SSH authentication

  9. When prompted with a security alert about the server’s host key, click Accept to continue

    Accept security alert

  10. When prompted for a username, enter ec2-user and press Enter

    Enter username

  11. You are now successfully connected to your Amazon Linux instance

    Successful connection

  12. Verify your connection by testing network connectivity:

    ping amazon.com -c5
    

    Test network connectivity

🔒 Security Note: Always keep your private key files (.pem and .ppk) secure. Never share these files or store them in public repositories, as they provide direct access to your EC2 instances.