Connecting via Linux
Linux natively supports ssh. If you have a Linux PC or VM (virtual machine), this method is straightforward. I use the free VMWare Player software to run a Linux VM on my Windows PC.
To connect to your cloud computer via Linux, there are four steps.
- Boot your local Linux machine. I began by running the VMWare Player program and starting a Linux VM on my laptop.
- Copy the *.pem file I downloaded back in Step 4 to your Linux machine. I copied the file from my Windows PC to my Linux VM by putting the *.pem file in a shared folder on my Windows PC. My file was called dreid9.pem.
- Follow the step listed in the Connect instructions from Amazon. Enter the command chmod 400 dreid9.pem on the command line on your Linux machine.
- Enter the ssh command given in the Example shown in Figure 3.
The command I entered was
ssh -i dreid9.pem email@example.com.
This connected me to my LAMP server, as shown in Figure 4 below.
Figure 4: Logged in via SSH - Linux
The ssh command seems complex, but makes sense if you break it down. The command I entered told my computer to use the dreid9.pem file for authentication, use root as the user name, and the address of my cloud machine is ec2-184-72-207-244.compute-1.amazonaws.com.
My cloud computer doesn't have a Public IP address, it has a publicly resolvable name. In my case, the resolvable name of my cloud computer is ec2-184-72-207-244.compute-1.amazonaws.com. The name is a bit cumbersome, but copy and paste saves the typing.
At this point, I am now securely connected to the command line of my cloud computer with full root privileges. My cloud computer has a network interface, memory, disk space, a processor, and I can configure to be a web server, run MySQL and Perl scripts.
Connecting via Windows
Windows doesn't natively support ssh, but you can access your cloud computer via a Windows PC using the free software called Putty. You'll need both Putty.exe and Puttygen.exe to access your cloud computer via Windows. Both are available here.
To connect to your cloud computer via Windows, there are four steps.
- Run puttygen.exe on your Windows PC. Select the option Load an existing private key file. When you select this option, you can browse your hard drive for your *.pem file. You'll have to select the option for all file types for puttygen to find your *.pem file. Once you've selected your file, select the option to save private key. I saved my file as doug.ppk.
- Run putty.exe.
- Go to the Putty Category pane on the left, expand Connection and SSH and select the Auth option. In this option, browse to the *.ppk file you just created, as shown in Figure 5.
Figure 5: Configuring the Putty key
- Point to the resolvable name of your cloud computer via the Session option at the top of the Category pane on the left of the Putty program. In the Host name field, paste the resolvable name of your cloud computer. In my case, it is ec2-184-72-207-244.compute-1.amazonaws.com. Give this connection a name, I called mine AWS, and saved it, as shown in Figure 6.
Figure 6: Saving the putty session
- Highlight your newly created session. I called mine AWS. Click Open. Putty will now set up an ssh session with your cloud computer. You'll be prompted to enter your user name, which is root, and you'll be at the same level of access as via Linux as displayed in Figure 7.
Figure 7: Logged in via SSH - Windows
Although there a few more steps to get Putty running versus Linux, I find using Putty more user friendly. Accessing my cloud computer is now point and click. I just launch Putty, click on my Saved Session called AWS, and click Open.