Creating EC2 instances is as easy as pressing a button. But, connecting to EC2 is not as easy. There are basically two easy ways to connect to ec2 via windows and mac respectively. Macs are famous for the simplicity they bring to a developers life. In this case also macs make it super easy to connect to EC2 compared to windows. Before you get started with this tutorial you will need pem key which a private file that you are requested to download by amazon when you first create an instance.
Putty: The Magician
Putty is a software for windows that allows you to connect to ec2 instances with ease. You can download putty by clicking here. Once you download and install putty you will see two apps putty and puttygen. First you need to open PuttyGen. Here in type of key you need to select RSA and choose load to browse your pem file. By default puttygen searches only for ppk files. Click on ppk files dropdown and select all files. Now you can save your key to your local machine.
Once converted now you need to open putty main app. Now you will need host name of your ec2 instance you can simply copy that from ec2 settings page. it will be someting like ec2@ipaddress. Paste that in hostname select ssh as connection type and 22 as port. Now in the side pane go to connections -> ssh -> auth -> credentials and browse your ppk file here. Now click open a new terminal windows should open where it will ask for your username and password if any. Now you are connected.
Mac: The Magic
When it comes to mac you only need to enter two commands in your terminal. Once you have downloaded pem file in your downloads folder cd your terminal into downloads folder and enter these two commands. ec2@ipaddress refers to your ec2 instance public dns address.
chmod 400 mykey.pem
ssh -i ./mykey.pem ec2@ipaddress
Be First to Comment