How to create AWS EC2 Ubuntu VM instance for free and access from Windows Machine using Putty

Diwaker Mishra
7 min readJun 15, 2021

Here is the video for the same -

In this blog, we will learn how to create a Ubuntu Virtual Machine(VM) on Amazon Web Service(AWS) and access it from our Windows physical device using Putty Software.

Before creating AWS Ubuntu Machine, Let’s understand Virtual Machine and its benefits-

What is a virtual machine?

Basically, a virtual machine (VM) is software that runs programs or applications without being tied to a physical machine. In a VM instance, one or more guest machines can run on a physical host computer.

Each VM has its own operating system, and functions separately from other VMs, even if they are located on the same physical host.

Multiple VMs can share resources from the physical host, including CPU cycles, network bandwidth and memory.

Desktop/Laptop computer systems can also utilize virtual machines. The biggest example here would be a Windows User running a virtual Ubuntu 18 instance on their physical Windows hardware.

Virtual Machine Types

There are two types of virtual machines organizations can use:

  • Process Virtual Machine- Also known as an application virtual machine, it supports a single process or application to run on a host OS. It is used to mask the underlying hardware or OS and execute the application just like other native applications. For example, Java applications are implemented using Java virtual machine (JVM).
  • System Virtual Machine- Also known as hardware virtual machine, virtualizes a complete operating system and can be used as a substitute for a physical machine. It shares the physical resources of the host machine but has its own OS. The virtualization process runs on a hypervisor or a virtual machine monitor running on bare hardware (native virtual machine), or on top of an OS (hosted virtual machine). For example, VirtualBox and VMware ESXi.

Advantages of virtual machines(VM)

  • Access VM from any Machine - any time.
  • Because the software is separate from the physical host computer, users can run multiple OS instances on a single piece of hardware, saving a company time, management costs and the physical space.
  • Developers use VMs in order to test apps in a safe, sandboxed environment.
  • Easy maintenance, application provisioning, availability and convenient recovery.

Let’s Create a Virtual Machine on AWS Platform

Go to your favorite browser and hit https://aws.amazon.com and click on “Sign In to the Console”

Login with your credentials-

Search “EC2” from search Bar and click on it -

Currently we have 0 running instances, Let’s create one. Click on Instances(running)

Now Click on “Launch Instances”-

We have 7 simple steps, We can leave many of them as default for basic Machine creation.

In Step 1- Choose an Amazon Machine Image(AMI), We are choosing Ubuntu 18.04-

Step 2 — Choose Instance type as “t2.micro”. It comes under free tier eligibility. For more details about AWS Instance types — https://aws.amazon.com/ec2/instance-types/

Step 3 - Keep Configure Instance as it is and click on “Next: Add Storage”

Step 4 - If needed, we can assign addition storage space to our VM, for now let’s keep it by default 8 GB and click on “Next : Add Tags”-

Step 5 - We can add tag to differentiate between our VMs. Click on “Next : Configure Security Group”-

Step 6 - Configure Security Group, Keep it as it is and click on “Review and Launch”. For more about security groups-https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html

Step 7 - Review and Launch. Just click on “Launch”

A pop-up will appear for choosing key pair. Choose “Create a new key pair” from dropdown-

Give a name to key pair and click on “Download Key Pair”. We need this .pem file to generate .ppk file later using PuTTYgen. Click on Launch-

Launch Status details will appear with helpful resources. Scroll it down-

Now click on “View Instances”

Oh Yeyy! Our brand new Ubuntu Virtual Machine is up and running

Click on checkbox against VM instance to get its details-

So, We have created an Ubuntu VM Machine. Now we will connect to this Instance.

If your physical device is also ubuntu, you can use SSH Client-

  1. Open an SSH client.
  2. Locate your private key file. The key used to launch this instance is test-flsk-app.pem
  3. Run this command, if necessary, to ensure your key is not publicly viewable.
  4. chmod 400 test-flsk-app.pem
  5. Connect to your instance using its Public DNS:

Example: ssh -i “test-flsk-app.pem” ubuntu@ec2–54–215–247–226.us-west-1.compute.amazonaws.com

Let’s connect to this VM from windows Machine, as I am using windows machine-

To connect to VM Machine we will use putty (A software to connect). In putty we need .ppk. To get .ppk file we will use PuTTYgen to generate .ppk file from .pem file(which we downlaoded while creating VM)

So let’s generate a .ppk file using PuTTYgen. In windows machine, click on windows button and search for — “PuTTYgen”-

Click on load button-

Choose .pem file(Which we downloaded while creating VM Machine)-

After choosing .pem, we can click on Save public key or Save private key

Save public key- It doesn’t need a password

Save private key- we need to provide key phrase(which will need later while connecting VM instance)

For simplicity, we are clicked on “Save public key”.

Pop up will appear for confirmation-

A notice pop up with Successful Imported… Click on “OK”

Save it somewhere in your machine-

So we generated .ppk using PuTTYgen, Now let’s connect to VM instance using PuTTY-

Search for “Putty” in windows-

Copy public IP address of VM machine from AWS console-

and paste that IP in Host Name and give a name to session-

Now, we will provide .ppk file to putty for authentication, click on SSH and then Auth, click “Browse”

choose your .ppk file

Now click on “Open”

A window will appear which will ask Login as

Here we need to login as “ubuntu”

Just press Enter and You are in your brand new Ubuntu VM Instance-

So this is how we can create a new Ubuntu VM on AWS and we can connect it through Putty from Windows OS.

Thanks for reading !

--

--

Diwaker Mishra

A technology enthusiast who loves to share learning on different technologies including Python programming, JavaScript and Cloud Tech.