Virtual Machine on Cloud

Virtual Machine on Cloud

Let's continue our journey of DevOps, In this blog we will learn how to host a virtual machine on different cloud providers. I will show the demo to host a Virtual Machine on Microsoft Azure.

To use any service or to host a virtual machine on any cloud provider, the prerequisite is that you first need to create an account using your credentials & a valid credit card. The company will deduct Rs 2 from your credit card to verify your identity and then they will reverse the transaction.

About Virtual Machine

A Virtual Machine (VM) is a compute resource that uses software instead of a physical computer to run programs and deploy apps.

Account Creation Step

The account creation step is very easy. You can create a new account using the below links.

AWS - AWS Console - Signup (amazon.com)

Microsoft Azure - Azure Sign-Up

Google Cloud - Google Cloud Sign-Up

After creating an account the interface will look something like this.

  • Microsoft Azure

  • Amazon Web Services (AWS)

  • Google Cloud Platform

Hosting a Linux Virtual Machine on Microsoft Azure

Step 1 - After creating your account on Azure, the interface will look like the above image. Search for the "Virtual Machine" service from the Azure search bar.

Step 2 - Click on Create "Azure Virtual Machine"

Step 3 - Create a new Resource Group VMRG, so that it will be easy to search for a service deployed. Enter a virtual machine name as "practice-vm" & deploy it in Central India region.

Step 4 - Select the image you want to work with. I selected "Ubuntu Server" with & its default configurations and will SSH into the server.

Step 5 - Enter a desired username "azureuser" and Generate a new key pair for connecting with the server.

Step 6 - Click on the next "DISKS" step and keep the default settings.

Step 7 - Now go to the next step "NETWORKING" and check the mark "Delete public IP and NIC when VM is deleted". By default, a new Public IP, VPC, and subnet will be created.

Step 8 - Go to the next steps keep the default settings and hit the "Review + Create" button. After the validation is passed click on the "Create" button.

Step 9 - After clicking on the "Create" button a new popup screen will appear click on the "Download Private key and create resource" button and keep the private key safe in your system.

Step 10 - A new private key (.pem file) is downloaded in your system and then click on the "Go to resource" button.

Step 11 - Now open the command prompt and type the following command.

ssh -i <private-key-file-path> username@public_ip

Step 12 - The new VM is now up and running, you can play with it.

Step 13 - After using the VM, enter the "exit" command and terminate the VM using the AZURE portal. (MOST IMPORTANT STEP)

This is how we can connect our virtual machine using Microsoft Azure Portal. Next, I will try to deploy the VM (EC2 Instance) on AWS.

For a .pem private key file, we will use the following command.

ssh -i <private-key-file-path> username@public_ip

For a .ppk private key file, we will use Putty.

The next blog will soon be published. Happy Learning 🚀