https://www.cidevops.com/2018/02/how-...
Pre-requisites:
1. Keys(for e.g., yourkey.pem) already downloaded in your local machine, preferably in Downloads folder.
2. EC2 is up and running
3. For windows laptop, you need to install Git by downloading from this URL - https://git-scm.com/downloads. For Apple laptop you need to download iTerm from here.
Mac Laptop instructions
Open iTerm window, type the below command to go to downloads directory.
cd downloads
For few Mac laptops, it may add .txt in the end of pem file. in that case you need to remove .txt in the end
pwd
and then execute below commands to make sure you are not making keys publicly viewable.
chmod 400 *.pem
Paste the url from example highlighted above in step # 4.
ssh -i "mykey.pem" ubuntu@dns_name.compute.amazonaws.com
type yes when it is asking to connect.