Virtual machines are operating systems that emulate the physical operating system. Almost all parts, virtual machines are the same as their physical counterpart, with some exceptions. There are several platforms to host your virtual machines on. For example, Microsoft Hyper-V and VMWare are the two major players. Virtual machines can also be hosted on cloud services, such as Microsoft Azure or Amazon Web Services.
What is Virtual Machine
Virtual machines, also known as the guest operating systems, sit on the host system’s physical server, and the hypervisor software manages the virtual machines.
To make the concept of virtual machines much easier to understand, let’s go ahead and build out a model. First, we start with our single server, our host system.
In our example here, we’re using Ubuntu Server 2018. This server will be provisioned with the right resources to support the hosted VMs.
The next step is to add our guest operating systems; these guests may be the same or have different operating systems than a host.
Why use Virtual Machine in Cloud Computing
There are several benefits to using virtual machines instead of the physical server for each workload. First, a server that hosts multiple VMs can reach 50 to 80% utilization, unlike the typical application server that only reaches five to 10% utilization. This means that fewer physical servers are required, which reduces purchasing, energy, and maintenance costs.
Virtual machines can also scale according to a workload. For example, if the virtual machine requires more resources, these resources can either be manually allocated or automatically allocated, depending on the resource in the VM management tools.
The advantages of using virtual machines on the public cloud are numerous. First, you only pay for the virtual machine while it is running. It can be substantial cost savings if you turn off the virtual machines when they’re not used. I see this in test and dev scenarios all the time.
VMs are fast and straightforward to set up; even better, when an environment is built, you can template and then rebuild it or duplicate that environment with a few mouse clicks, and Azure virtual machines are highly scalable.
How to create Virtual Machine in Microsoft Azure
Azure virtual machines can be created through an Azure portal. This method provides the browser-based user interface to create Virtual machines and their associated resources. This tutorial shows you how to use the Azure portal to deploy a Ubuntu Server 18.04 in Azure.
If you don’t have the Azure subscription, create a free account before you begin.
Step 1: Log in to the portal and search for a virtual machine.
Type virtual machines in the search. Under Services, select Virtual machines.
Step 2: Add a new virtual machine
Virtual machines page, select Add. You will see the following screen.
Step 3: Fill out all the necessary details.
Under the Project details, ensure the correct subscription is selected in the Basics tab. It is a Free Trial, and then I am choosing an already existing Resource group or a new Group.
Under Instance details, type azvmmachine for the Virtual machine name, choose (US) Central US for your Region, and choose Ubuntu Server 18.04 for the Image. Leave the other defaults.
Then choose the size of Standard B1ls (1 vcpu, 0.5 GiB memory (₹301.08/month)). For this demo, it should be enough.
Step 4: Configure Administrator account
I have chosen to authenticate type Password, but you can also use SSH.
So, write your username and password or username or SSH key.
Step 5: Inbound Port rules
Select which virtual machine network ports are accessible from the public internet. You can specify more limited or granular network access on the Networking tab.
Select Inbound Ports: SSH(22)(It is for testing purposes only)
Step 6: Go to the Disks section
Azure VMs have one operating system disk and a temporary disk for short-term storage. In addition, you can attach additional data disks. The size of the VM determines the type of storage you can use and the number of data disks allowed.
In Disk Options, select Standard HDD.
Step 7: Go to a Network interface.
Define network connectivity for your virtual machine by configuring network interface card (NIC) settings. You can control ports, inbound and outbound connectivity with security group rules, or place behind an existing load balancing solution.
See the following screenshot.
Here, a network interface will be created for you when creating a virtual machine.
I have already created Virtual Network, and if you do not know how to do it, check out the How to create Virtual Network in Azure guide.
Leave subnet, public ip, NIC security group, public inbound ports, Select inbound ports as it is.
Step 8: Go to the Management section.
Go to the next Management section. You will see the following screen.
Leave all options as it is and go to the Advanced section.
Step 9: Advanced config for Virtual Machine
In an advanced section, you can add additional configuration, agents, scripts, or applications via virtual machine extensions or cloud-init.
Cloud-init is the widely used approach to customize the Linux VM as it boots for the first time. You can use the cloud-init to install packages and write files or configure users and security.
Leave all the options as it is.
Inside the tags section, you can create a key-value pair tag.
Finally, click on the Review + Create button.
After reviewing the whole process, click on the Create button.
It will take some time to complete the deployment. So please patiently wait to be completed.
Now, go to the resource group, and you will see something like this.
So, it has created the following 5 things.
- Virtual Machine
- Public IP Address
- Network Security Group
- Network Interface
- Disk
Now, go to azvmmachine. You will see the following information.
So, we have created our Microsoft Azure Virtual Machine.
Conclusion
One of the main functions of cloud computing services like Microsoft Azure is creating, deploying, and managing virtual machines. With the right cloud computing tools in hand, an enterprise can create dozens, hundreds, or even thousands of virtual machines and then decommission them instantly when they are no longer useful.
This tutorial shows how to create a virtual machine in Azure, build a network interface, disk management, admin account creation, etc.
That’s it for this article.