Creating an EC2 Virtual Machine on AWS Management console
Tags: cloud, devops, aws
Published: 2023-04-07 18:06:48

**What is a virtual Machine?**

A virtual machine is a digital emulation of a physical computer. It provides a complete virtual environment, that includes virtualized hardware such as CPU, memory, storage, network interfaces and other devices.
It runs independently of the host i.e. it operates as a physical computer.

Amazon web services(AWS), like other public cloud vendors enables you to build, manage and deploy applications that can be accessible over the internet using your favorite tools and services offered. 
It provides services that enable you perform different functions, from running an existing application on virtual machines, saving backup files in cloud to creating and deploying.

To create a virtual machine on AWS we go through the following steps:
**Step 1** - Create a free AWS account here [](https://aws.amazon.com/free)

**Step 2** 
- Click on the services tab -> compute
- Then click on EC2 to setup VM

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nuih7cpr0wssysk0v126.PNG)

**Step 3** : We create an instance

- Click on instances from the dropdown
- Next you launch instance

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suy5n4lujdhhr8cejv24.PNG)

**Step 4**
- Set preferred name for your virtual machine
- Select preferred operating system, server type and instance type
- Create your key pair, input a unique key pair name.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxbjvdbvptjesda1aris.PNG)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umakjmfm2gob9yjpjfqj.PNG)

**Step 5** : We configure our network settings but if you have an existing network, that can be use. Else, we use the default preselected network. Then, select "Allow RDP traffic from".
Every other default setting remains the same, then we click on the "launch instance" button at the bottom right of our screen to deploy our virtual machine.
- Select the preferred instance then click on connect

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvhaka5tb1lf8e60lh4i.PNG)

- You might get a warning that says "we weren't able to connect to your instance". click on the RDP client tab
NB: if you are doing the setup on a macbook, you will need to download a remote desktop to avoid login difficulties. 
But first, let's setup our unique password.

- Click on get password
- Upload the downloaded file generated when key pair was created.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0txmjluod6fbq8qxsyai.PNG)
- Click on Decrypt password
- Copy generated password
Next, we download remote desktop file

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/taup8meowgql94vl22gn.PNG)
We launch the downloaded remote desktop and it requests for a password. We input the copied password from the previous step...
And Voila our Virtual Machine is up and running.

![Running virtual machine connected via ssh](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0b8o5pv2ciiui269r1s.jpg)

To terminate a resource so as not to incur unexpected charges:
- Return to the instances tab
- Select the Virtual machine to terminate
- Click on the instance state dropdown, the you terminate instance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2a6bh4hcnzpizg0govi.PNG)

Thank you for reading this resource.
Any suggestions how to do better or changes to make? Kindly drop them in the comment section