How to create a virtual machine on AWS
Tags: cloud, aws, beginners, writing
Published: 2023-04-04 22:02:27

## Introduction to Virtual Machines and Cloud-Based Computing with Amazon EC2
A virtual machine is a software based computer that resides within another computer's operating system. It is essentially creating another computer within a computer.
A virtual machine in the cloud is similar to a traditional virtual machine. However it is hosted and managed by a cloud service provider such as Amazon Web Services (AWS), Google Cloud Platform or Microsoft Azure.

Amazon Elastic Compute Cloud (Amazon EC2) is a cloud computing service provided by AWS. It allows users to launch virtual machines known as EC2 instances.

## Step-by-step process to create a virtual machine on AWS
This guide will walk through the process of setting up a virtual machine using Amazon EC2.

- <b>Step 1</b>: Create or login to your AWS [account](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all).

- **Step 2**:Login into the AWS Management Console.

- **Step 3**: Select a region where you want to launch the virtual machine. The AWS regions is located in the top right of the navigation bar on your console page.
![AWS region on the navigation bar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3g5cuf36tw58fglbi3rc.png)

- **Step 4**: Click on 'Services' at the top left of the navigation bar and select 'Compute'. 
![AWS Services](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mzzgmurx5847dsjimdw.png)

- **Step 5**: From 'Compute' click on EC2. This opens up the EC2 Dashboard.
![EC2 Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0339q1a21o6nc08lm2jx.png)

- **Step 6**: Once in the EC2 Dashboard, click on 'Launch Instance'.
![Launch Instance image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvko2lhgzlvezm0wtypz.png)

- **Step 7**: Enter in a name for your virtual machine instance.
![Instance name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bpzoe16w9mrse6e8vs11.png)

- **Step 8**: Under the Application and OS Images section, select the operating system and machine configurations you prefer.
![Application and OS Images section](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/47avvu3rfbjfm5k27q6i.png)

- **Step 9**: Select the instance type that meets your computing, memory or storage needs. 
![Instance type section](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vi0b86lld6r4s7ngvu3h.png)

- **Step 10**: Enter a key pair name. The key pair name will be downloaded to your system and you will use the key pair to securely connect to your instance. Save the key pair in a location that will be easy to remember and access.
![Key pair name section](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhqul9q4nzpqn1vd87l9.png)

- **Step 11**: Configure network settings and storage.
![Network settings and storage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7l0aw6d037kq3y3ee09.png)

- **Step 12**: Configure advanced details (if required).

- **Step 13**:  Click on Launch instance.
![Instance launched](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyokze6wht94d9qj27tb.png)

- **Step 14**: After you successfully launch your Instance, navigate to the instance and select it.
![Instance selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gtfr38w3syi3izwc4p4s.png)

- **Step 15**: Click on connect and select 'RDP Client' and go to 'Get password'.

![RDP Client-Password ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l24bjv516i606pe5bo3w.png)

- **Step 16**: Once in the Get password tab, upload your private key file, decrypt the password and then copy the password.
![Password decrypted](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gt7dsmj5hwku1zjnn9xe.png)

- **Step 17**: Download your remote desktop file. 
For Mac users that configured a virtual Window OS, ensure you download a remote desktop from the app store before downloading the remote desktop file. The remote desktop file is needed to connect to your instance using the remote desktop connect app.

- **Step 18**: Navigate to the remote desktop file after downloading, open it with the remote desktop app and enter in your password.
![Password entered on remote desktop app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vqe617cg0ij28k0g9ks.png)

After you input your password, the system will log you into your new virtual Window OS, and you can begin using it.
![Virtual Window OS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnoo46q1mjkaochgvfjk.png)

## How to delete your virtual machine 
If you no longer have use for your virtual machine, you can close it and perform the following steps to delete it on AWS.
1. Open the Amazon EC2 console again and select 'Instances' from the navigation pane.
2. Select the Instance you want to delete.
![Instance selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dehm4bhb9xrl9zn512fw.png)
3. Click on 'Instance State' and then select 
Terminate'.
![Terminate Instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4149twkm0etmx17q3xm7.png)
4. In the "Terminate Instance" dialog box, click on 'Terminate'.
![Terminate Instance dialog box](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m2msxcwcjxxogimef6nb.png)
5. After termination is complete, a successful termination message appears at the top of the screen.
![Successful termination of Instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5h6cfphc4pqxsuqnrtb.png)