Connect to EC2 instance using SSH and Ubuntu terminal

Assuming you have a Key Pair file .pem already created in EC2 management console, connect to your instance, in my case Ubuntu 12.04.2 LTS 64 with this command:

$ ssh -i ec2.pem

where ec2.pem should be name of your key file, this command works only if you are in the directory where .pem file is stored, otherwise use ssh -i /home/Downloads/your_key_name.pem ...

ubuntu is the default user name used on EC2 instances with Ubuntu default AMIs. is Public DNS, you can find it in EC2 management console > Instances > Description.

First time you will be asked to trust public key, replay by writing whole word "yes".

The authenticity of host ' (' can't be established.
ECDSA key fingerprint is 55:1b:99:99:a4:9c:eb:94:fd:7b:4f:11:5b:bf:94:7d.
Are you sure you want to continue connecting (yes/no)? yes 

Hit Enter and then you will be connected.

Warning about permission too pen is solved by chmod 400:

Permissions 0664 for 'ec2.pem' are too open. 
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: ec2.pem
Permission denied (publickey). 

$ sudo chmod 400 ec2.pem

This should do the trick.

Using elastic IP to make log in line shorter

You do not have to use a long server name like

$ ssh -i ec2.pem 

instead assign a elastic IP to your instance and use

$ ssh -i ec2.pem ubuntu@

Using same Key Pair for more EC2 instances in multiple regions and zones

You do not have to create new Key Pair for every zone or region or instance, instead, use Key Pair Import and use the same on everywhere, it is a time-saver and I do not see the security issue, once you loose any of them it is too bad.