Amazon Web Services (AWS) has more than a thousand services, much of them are free to try and cost very little once you start paying. There are a few programs like pay as you go and reserve resources, in other words, it is incredibly convenient. In this post, I will provide a step by step guide on how to launch a Linux virtual machine and how to connect to it. First of all head to https://aws.amazon.com and create an account, if you don’t already have one, and click on the “Create an AWS Account” or “Create a Free Account” button.
Follow the wizard entering all the information like name, address, and email address. You’ll need a credit card to finish the registration, but don’t worry, as long as you use the Free Tier you’ll be ok. The following slideshow contains all the necessary steps to create an instance. Keep reading after the slideshow for more detailed instructions.
- Click “Launch a virtual machine.”
- Click “Get started” on the left EC2 Instance.
- Type in a name like “MyLinuxInstance” and click “Use this name.”
- Click or leave the “Amazon Linux AMI” selected because this is available for the free tier.
- Select the “t2”, which is eligible for free tier, and click “Next.”
- Create a key pair. You can leave the default name, but it is imperative that you download it to your local computer because you will not be able to do it later.
- Click the “Create this instance” button, and wait for a few seconds.
- Click the “Proceed to the EC2 console” button.
Depending on how many times you’ve done this you may land on a slightly different page. The trick here is to navigate to the EC2 dashboard and click the link to the Running Instances.
Once there you can select the newly created instance. Take note of the public IP address because you’ll need this to connect to Linux virtual machine.
If you are on a mac or another Linux, change the permission on the Key Pair file to 600 with the following command:
chmod 600 MyLinuxInstance.pem
The file name (MyLinuxInstance.pem) will depend on the name you chose for your Key Pair. Then connect like this:
You can use the Public DNS or the Public IP, and I tested the permissions with 600, and it worked too. You’ll always use ec2-user as the user. In case you are using PuTTY for Windows, there is a short procedure that you need to take care of.
- Start the application PuTTYgen (PuTTY Key Generator) that is installed with PuTTY. In case you don’t have PuTTY you can download it here.
- Leave the RSA and 2048 bits default values and hit the “load” button.
- Change the type of file to “All files” and select the Key Pair file and click “Ok” in the confirmation window.
- The click Save Private Key, also click Yes to the Pop-up warning, and select the folder where you want to save the key.
Now go ahead and close the PuTTY Key generator and start PuTTY. The following slideshow contains the steps to create a new session using the key previously generated and saved by PuTTYGen.
- Start PuTTY
- In the Host Name enter the Public DNS or the Public IP
- On the left Category pane expand Connection -> SSH -> Auth
- Select the previously generated Key File clicking the “Browse” button.
- Save your session and launch it. You may have to click “Yes” to accept the signature if this is the first time login in.
And that is how you can land on a Linux Virtual Machine in less time than installing your own locally.