How to spin up a Linux instance in AWS

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 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.


This slideshow requires JavaScript.

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.

This slideshow requires JavaScript.

  1. Click “Launch a virtual machine.”
  2. Click “Get started” on the left EC2 Instance.
  3. Type in a name like “MyLinuxInstance” and click “Use this name.”
  4. Click or leave the “Amazon Linux AMI” selected because this is available for the free tier.
  5. Select the “t2”, which is eligible for free tier, and click “Next.”
  6. 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.
  7. Click the “Create this instance” button, and wait for a few seconds.
  8. 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.

Screenshot 2018-02-08 14.56.27

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.

Screenshot 2018-02-08 12.09.09.png

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:

Screenshot 2018-02-08 12.00.44

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.

This slideshow requires JavaScript.

  1. Start the application PuTTYgen (PuTTY Key Generator) that is installed with PuTTY. In case you don’t have PuTTY you can download it here.
  2. Leave the RSA and 2048 bits default values and hit the “load” button.
  3. Change the type of file to “All files” and select the Key Pair file and click “Ok” in the confirmation window.
  4. 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.

This slideshow requires JavaScript.

  1. Start PuTTY
  2. In the Host Name enter the Public DNS or the Public IP
  3. On the left Category pane expand Connection -> SSH -> Auth
  4. Select the previously generated Key File clicking the “Browse” button.
  5. 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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.