Connect your EC2 instance with terminal

Hello Friends, In the last tutorial we have learned how to create EC2 instance, Now we will learn how to connect EC2 instance with terminal

You will need to know the location of your key pair you created when you launched your instance. Usually this will be in your “Downloads” folder, but you may want to move it elsewhere.

For Mac OS & Linux Users

First of all we will change the PEM file permission. We will give it to 400

Next, Open your terminal and run the below command to change the permission

chmod 400 **/path/to/your/key/filename.pem

Next, Run below command to connect with EC2 instance

ssh -i /path/to/your/key/filename.pem [email protected]

Here ubuntu is the default usrename created by aws. Change ipaddress string with your ipaddress. You can find this under EC2 instance

For Windows

To connect with ec2 instance you need putty. If you don’t have the PuTTY software installed on your system, you will need to download it from Be sure to select the entire package as shown below, as it will include all the needed utilities such as puttygen and pageant.

Generate ppk file

Next, open PuTTYgen, On the PuTTYgen dialog box, click the Load Button and then select the .pem file that you downloaded from AWS. Note: when browsing for your pem file be sure to select All Files in the dropdown list that is located to the right of the File name field. PuTTYgen will then load and convert your file.

Next, click on “Save private key”. You will receive a warning message asking if you want to save this key without a passphrase. Be sure to select Yes.

Provide a name for your ppk file and click save.

Connect with Server

Next, Open PuTTY

Enter hostname

Enter your Host Name into the appropriate field. This will be in the format of: [email protected]_dns_name. Be sure to specify the appropriate user name for your AMI type. For example:

•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.

•Otherwise, if ec2-user and root don’t work, check with the AMI provider.

Here is an example for connecting to an Amazon Linux AMI:

Next, click on the + button next to the SSH field to expand this section. Then click on Auth (which stands for authenticate) and enter the name of your private key file (i.e. the ppk file) where it says Private key file for authentication (if you click on browse you can easily search for the directory where you have stored it).

Lastly, click on Open to start your SSH session.

Note: if this is the first time that you are logging into the instance, you will receive the following alert.

Click on Yes to continue.

Congrats!! You have successfully connected with the EC2 instance

In the next tutorial we will learn how to install Apache and Nginx server in the EC2 instance and launch our website


  1. Kristian said:

    Does your blog have a contact page? I’m having problems locating it but, I’d
    like to shoot you an e-mail. I’ve got some creative
    ideas for your blog you might be interested in hearing. Either way, great site and I look forward
    to seeing it improve over time.

    Have a look at my page :: cheap flights

    January 31, 2021
  2. Mikel said:

    Your style is very unique compared to other folks I’ve read stuff
    from. I appreciate you for posting when you have the opportunity,
    Guess I will just book mark this web site.

    my webpage; cheap flights

    February 1, 2021
  3. Hattie said:

    Link exchange is nothing else however it is simply placing the other person’s blog
    link on your page at appropriate place and other person will also do similar for you.

    Feel free to surf to my website cheap flights –,

    February 2, 2021
  4. Kathaleen said:

    Nice post. I was checking continuously this blog and I
    am impressed! Extremely helpful information specifically the last part :
    ) I care for such info a lot. I was seeking this particular information for a long time.

    Thank you and good luck.

    My blog – cheap flights

    February 2, 2021
  5. Lila said:

    This is my first time visit at here and i am actually happy to read everthing at alone place.

    Feel free to visit my web-site; cheap flights (

    February 3, 2021
  6. Kbcxbype said:

    canadian pharcharmy online no precipitation ed drugs modafinil online pharmacy

    February 5, 2021
  7. NncsGeste said:

    viagra without percription does viagra go stale viagra without a prescription johnson pharmacy

    February 8, 2021
  8. Celesta said:

    I do consider all the ideas you’ve presented to
    your post. They’re very convincing and can definitely work.
    Nonetheless, the posts are too brief for starters. May
    you please prolong them a little from subsequent time?
    Thanks for the post.

    Feel free to surf to my site: cheap flights –

    February 12, 2021
  9. Labxguany said:

    viagra ou cialis efficacitГ© cialis duree de vie vicodin and cialis interactions

    February 12, 2021

Leave a Reply

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