One Page Zen

Web Design. Simplified.

  • Tutorials
    • Google Cloud
    • Amazon Cloud
    • Microsoft Cloud
  • Start
  • Resources

How to SSH into EC2 Instances (AWS)

November 12, 2020 Leron Amin 19 Comments

FacebookTweetLinkedInEmail

With most cloud platforms, such as Google Cloud (GCP) or Microsoft Cloud (Azure), an SSH client is built-in. However, AWS does not include a built-in SSH client, and therefore requires you to use a third-party client in order to SSH into your EC2 instances.

In this tutorial you will learn how use a third-party SSH client (known as PuTTY) in order to SSH into your AWS EC2 instances.

Managing your AWS website’s files requires you to SSH into your EC2 instance. This can be achieved by using an SSH client such as PuTTY.

If you prefer to use a cloud platform with a built-in SSH client, check out the Google Cloud (GCP) or Microsoft Cloud (Azure) tutorials.

Before getting started with this tutorial, you should have already deployed an EC2 instance such as WordPress on Amazon AWS EC2.

There are 4 steps in this tutorial:

  • 1. Download PuTTY
  • 2. Convert SSH Key File
  • 3. Copy DNS IP Address
  • 4. Configure PuTTY

1. Download PuTTY

ssh into aws ec2
PuTTY is the application that you will use to SSH into your AWS EC2 instance. You can download it for free here.

2. Convert SSH Key File

ssh into ec2 instance
After downloading PuTTY, open the PuTTY Key Generator application (PuTTYgen), and click the Load button to upload the key file that you downloaded in the previous step.
ssh into ec2 instance
Next, click the Save private key button.
ssh into ec2 instance
Make sure to save the file with the .ppk extension.

3. Copy DNS IP Address

ssh into aws ec2
From your AWS homepage, naviagate to your EC2 dashboard.
ssh into aws ec2
Click on Instances in the left sidebar menu.
ssh into aws ec2
Copy your instance’s Public DNS IP address.

4. Configure PuTTY

ssh into aws ec2
Open the main PuTTY application and enter your username (see list) followed by @ and the Public DNS IP Address that you copied from the last step into the Host field.
ssh into aws ec2
Next, navigate to the Auth section in the left-sidebar menu. Then, upload the PuTTY key file that you converted in the last step.
ssh into aws ec2
Lastly, navigate back to the the Session section at the top of the page, and click the Open button to establish the SSH connection.

Don’t know your username?

  • • For an Amazon Linux AMI, the user name is ec2-user.
  • • For a RHEL AMI, the user name is ec2-user or root.
  • • For an Ubuntu AMI, the user name is ubuntu or root.
  • • For a Centos AMI, the user name is centos.
  • • For a Fedora AMI, the user name is ec2-user.
  • • For SUSE, the user name is ec2-user or root.

If ec2-user and root don’t work, check with the AMI provider.
Source: Amazon AWS User Guide

That’s it!

ssh into ec2 instance
After you’ve successfully connected to your instance, you will see a window pop up with your instance details.

From this point forward, you’ll be able to quickly SSH into your EC2 instance simply by loading your instance’s saved Public IP address from the PuTTY dashboard.

If you have any questions or comments about this tutorial, be sure to post them below!

Thanks,

signature

Related Posts

  • The Most Important Linux Commands (With Examples)
  • How to Remove Bitnami Banner WordPress AWS
  • How to Migrate WordPress to AWS (Full Guide)
  • How to Install WordPress on AWS
  • How to Transfer a Domain to AWS
FacebookTweetLinkedInEmail

Filed Under: Amazon Web Services, AWS Networking Tagged With: aws, wordpress

Comments

  1. ansari abdullah says

    May 2, 2020 at 3:43 am

    I am not able to establish https connection for my wordpress website. i have an ssl certificate linked to my domain but its not working

    Reply
    • Leron Amin says

      May 13, 2020 at 9:05 pm

      Hi Ansari,

      Please describe any error(s) that you’re seeing, and I will see how I can assist.

      Thanks,
      Joe

  2. Ansar Ulhaq says

    September 30, 2018 at 3:48 pm

    how to open server,s configuration file please? I am referring to your tutorial on you tube. The part which starts after this tutorial here.

    Reply
    • Leron Amin says

      October 1, 2018 at 11:00 am

      Hi Ansar,

      There is a server configuration file which you can open by running the following command:

      sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf

      Let me know if you have any questions,
      Joe

  3. Mike Lowe says

    July 16, 2018 at 11:44 pm

    So should I now be seeing my website auto-switch from not having a www. to having one if I just enter the domain name? I did these steps (plus a few further ones like pasting text into Putty that i saw on another version of this tutorial), but I’m still not seeing this auto-switching take place when I type in my domain.

    I just registered the URL today. Does it take a while? FWIW, it is showing up when I do either or, so it’s setup properly, but I just am not seeing this auto-switching.

    Reply
    • Leron Amin says

      July 17, 2018 at 11:35 am

      Hi Mike,

      At the end of part 2 of this tutorial, I include a section on how to configure the redirect to the www. version of your domain.

      Also, remember to restart your Apache server after making the changes.

      Hope this helps and let me know if you have any questions,
      Joe

    • Mike Adamski says

      July 17, 2018 at 3:55 pm

      That’s the tutorial I watched. I’ll try resetting the Apache server…but how do I do that????

    • Leron Amin says

      July 17, 2018 at 5:19 pm

      Hi Mike,

      Use the following script to restart your Apache server:

      sudo /opt/bitnami/ctlscript.sh restart apache

      Hope this helps,
      Joe

    • Mike Adamski says

      July 17, 2018 at 5:36 pm

      Total noob here…where do I use this script? I literally have never even heard of this before, so details would be super helpful!

    • Leron Amin says

      July 17, 2018 at 7:08 pm

      Hey Mike,

      Watch the video at the top of this this page, starting with minute 12:00. I show step-by-step how to restart your Apache server using the following command:

      sudo /opt/bitnami/ctlscript.sh restart apache

      Hope this helps,
      Joe

    • Mike Adamski says

      July 18, 2018 at 3:18 pm

      I got it to work! I think the confusion comes from what appears to be a copy/paste error in your instructions in which you say to “copy the three lines of code below” in two consecutive screenshots, when the second one is just that one code to reset the Apache server.

    • Leron Amin says

      July 19, 2018 at 9:52 pm

      Sounds good Mike – I’m glad you got it working!
      Also, thanks for the feedback – I will look into updating the tutorial.

  4. Aden says

    March 16, 2018 at 6:32 pm

    what can i use if i have a mac ? i can’t download putty

    Reply
    • Leron Amin says

      March 18, 2018 at 1:59 pm

      Hi Aden,

      You will have to manually generate an SSH key pair through your terminal.

      Check out this resource for more information.

      Let me know if you have any questions,
      Joe

  5. Isabel says

    March 15, 2018 at 5:27 am

    Hey hey hey Leron, 😉

    I want to test Amazon AWS thank you for your tutorials my friend.

    Question:
    Once the SSH is setup here, can I then follow the SSL certificate, Filezilla setup tutorials on the GCP Bitnami?

    Regards,
    Isabel

    Reply
    • Leron Amin says

      March 15, 2018 at 11:22 am

      Hi Isabel,

      The SSL certificate tutorial should work (don’t quote me because I haven’t tested it), but there might be slight differences in the file paths.

      As far as the FTP tutorial is concerned, it will be similar but your username will probably be different (if bitnami doesn’t work, try ec2-user).

      Let me know if you run into any issues! 😀
      Joe

  6. Preetham says

    March 4, 2018 at 1:52 pm

    How do we create the ssh user. In your case it was bitnami

    Reply
    • Leron Amin says

      March 5, 2018 at 6:33 pm

      Hi Preetham,

      The SSH usernames are issued by Amazon. There is a common list of usernames at the bottom of the tutorial page.

      Check out the documentation for more information on connecting to your EC2 instances with SSH.

      Talk to you soon,
      Joe

  7. Leron Amin says

    November 27, 2017 at 3:12 pm

    What did you think of this tutorial?
    Please share your questions and comments below!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Want Exclusive Tutorials?

Welcome to One Page Zen!

Through this blog I hope to introduce web developers to cloud computing!

author-bio

facebook-support-group kinsta-cloud-hosting

Want Exclusive Tutorials?


Contact | Sitemap | Legal | Privacy Policy | Affiliate Disclosure
      Copyright © 2017 - 2019 One Page Zen
Share this Article

Email sent!