beehexa integrationsidebar
beehexa logo

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

connect to aws ec2 Linux instance using SSH

How to connect to AWS ec2 Linux instance using SSH?

After launching your Linux instance on AWS, a common practice is to enable SSH connections for provisioning, configuring, or deploying your application. I have done these practices daily because all tools that I am using such as Ansible, Capistrano, Fabric, Github, and BitBucket, need an SSH connection.

How to connect to the AWS ec2 Linux instance using SSH?

Firstly, we must have an SSH Client installed on your development machine

For Windows users, you should install Git Bash (Not putty as recommended in the AWS document)

For Ubuntu users, please run this command Sudo apt-get install OpenSSH-client

For Mac users, please run ssh -V to make sure it has been installed

I suppose that you have known to create an AWS EC2 instance; please log in to your AWS console and select the instance you have created.


Click on the connect button that I noted on the above screen, you will see a screen for guiding how to connect to your Linux instance.

guide for connecting to your aws instance using ssh

I hope you can connect to your Linux Instance now with this command

ssh -i "yourkeyfile.pem" [email protected]

but this is not the reason that I write this blog, you must configure to enable to connect your instance with this command

ssh [email protected]

To allow this to happen, we must follow these steps

  • Create public and private keys using ssh-keygen using your ssh client ( I use git bash as mentioned above), output will look like this
Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ~/.ssh/id_rsa.
Your public key has been saved in ~/.ssh/
The key fingerprint is:
0a:78:46:af:23:99:ac:b2:1e:ec:ef:c9:c9:b3:22:48 vagrant@vagrant-ubuntu-trusty-64
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|    .            |
|   o .           |
|  . + . S        |
|.E = o .         |
|oo= o .          |
|=o+oo.           |
|*++Oo            |
  • Copying the public key that you have just created to the remote server
cat ~/.ssh/ | ssh -i "yourkeyfile.pem" [email protected] 'cat >> .ssh/authorized_keys'

After that, you may access your Linux instance with this simple command, you do not have to specify the critical file anymore

ssh [email protected]

But it will be hard for you to remember the public DNS, you can config to change in the ssh config ~/.ssh/config

I am using Windows, I appended the file with these lines

	User ubuntu

After that, you can access your instance using this command

Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-36-generic x86_64)

 * Documentation:
 * Management:
 * Support:

  Get cloud support with Ubuntu Advantage Cloud Guest:

58 packages can be updated.
20 updates are security updates.

Last login: Sun Oct 23 14:55:15 2016 from

Important Note

To secure your instance, Your default security group does not allow incoming SSH traffic by default and enables your IP only when needing access


This blog is for me to remember the daily processes I go through. I hope it can help you guys save time by googling less. If you have any questions, please feel free to contact us.

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.