This is a quick tutorial and more of an additional information for my Cloud For Dummies article on EC2 .
An Ultimate Dummies Guide to AWS EC2
This is my second article in a series that I’m writing on Cloud for Dummies where I explain different services in…
Assuming that you have followed the article above and successfully created a web server with EC2 , let’s see how you can access the webserver via SSH to do better things.
While AWS Console is a powerful tool , there is still a lot of things that you cannot achieve with the console itself .
It’s a pain to put it straight .
Some situations that really need for a remote connection
- Imagine you have to tweak a file that’s on the server . It’s not possible for you to do it with console .
- You want to install a specific service let’s say a LAMP stack , upgrade python , install nginx
Let’s see how you can connect to the EC2 instance .
Before we start , remember the secret key that you downloaded ( a PEM file ) upon creating the EC2 instance . We need that before we proceed further.
If you are using a Windows machine follow the steps below.
- If you are using Git Bash then you can follow the steps follows under the Linux section
2. If you are using Putty then let’s start
Assuming that you have Putty already installed let’s first convert the PEM file to PPK .( Remember the extra step for PUTTY )
Follow the link below to convert a PEM to PPK , as PUTTY doesnt works with PEM files
Convert a .pem File into .ppk, and Vice Versa, on Windows and Linu
How do I convert my Amazon Elastic Compute Cloud (Amazon EC2) Privacy Enhanced Mail (.pem) file to a PuTTY Private Key…
3. Now we need to load the PPK key into PUTTY as follows.
4. Once then select the session and provide the details of your EC2-Instance IP and hit load . Alternatively you can also save the session and load later . You might have to change the IP if your EC2-Instance is not running on static IP.
5. You should now see a terminal window with the prompt as follows
6. Enter ec2-user and proceed and you should get the EC2 prompt as follows.
If you are using a Linux machine follow the steps below.
- Open the terminal and locate the directory where your pem keys are located
2. Fire the command
ssh -i <your-key.pem> ec2-user@<your-ec2-instance public IP>
When you hit enter , you should get the following prompt
3. Type yes and press enter and you should get the following prompt.
4. If you don’t get it check the Security Group settings that I have suggested which need to be updated to allow SSH ( port 22 ) connections from your IP .
5. Now you are remotely connected to your EC2-Instance and can proceed with firing commands directly into your EC-instance.