Creating a Virtual Machine Scale-Set in Azure (VMSS).

laoluafolami

Olaolu' Afolami

Posted on June 26, 2024

Creating a Virtual Machine Scale-Set in Azure (VMSS).

What is Virtual machine scale-set?

One intriguing feature provided by Microsoft Azure is called Virtual Machine Scale Sets (VMSS), which aids in the creation and management of a group of similar, auto-scaling Virtual Machines (VMs). VM instances can be automatically increased or decreased in accordance with predetermined parameters.

VMSS may be used to launch a collection of virtual machines (VMs) with the same operating system, applications, and data settings. In addition to offering load balancing, intelligent scaling, and connectivity with other Azure services, VMSS is a strong and adaptable tool for handling heavy workloads.

All things considered, VMSS is a significant Microsoft Azure feature that offers a scalable and reliable way to build and manage a group of similar virtual machines.

Auto-Scaling
With auto-scaling, you may set an automated limit on the amount of computing resources your application uses, according to how much it requires at any given time.

The main takeaway is that, regardless of how quickly or slowly, large or little, your site grows over time, you can now create a scalable architecture that will automatically scale up or down to meet your demands.

These are the most often used auto-scaling methods:

  • Horizontal Scaling

  • Vertical Scaling

Types of scaling

Vertical Scaling
If you have a single core processor and four gigabytes of RAM in vertical scaling, you may upgrade to a dual core processor and eight gigabytes of RAM. We refer to this as Scale UP. Scaling down means returning the configuration to its initial state.

Horizontal Scaling
Horizontal scaling, also known as scale out, is the process of starting with one virtual machine and gradually adding others with the same configuration. Once your sale or business requirement is met, you may also scale down to 1 virtual machine (VM). This technique is known as "scaling in."

Distributed architecture is required because applications are usually spread over several instances, allowing for redundancy and enhanced performance. A load balancer distributes requests to one of the application instances in order to provide your customers with quicker speed and lower latency.
Virtual Machine Scale Set (VMSS) let you Create and Manage a group of load balanced VMs. The number of VM instances can automatically increase or decrease in response to demand or a defined schedule.

VMSS

Creating a Virtual Machine Scale Set in Azure.

Sign in to the Azure portal
You can deploy a scale set with a Windows Server image or Linux image

  • In the Azure portal search bar, search for and select Virtual Machine Scale Sets.

VSS

  • Select Create on the Virtual Machine Scale Sets page.

VSS create

  • In the Basics tab, under Project details, make sure the correct subscription is selected and create a new resource group called vmssRG.

  • Under Scale set details, set myScaleSet for your scale set name and select a Region that is close to your area.

Create a VMSS

  • Under Orchestration mode, select Uniform.
  • Under the Security type blade select Standard.

  • Under Instance details, select a marketplace image for Image. Select any of the Supported Distros.

  • In Scaling mode choose the Autoscaling option. Then select Configure to set parameters for the scaling configuration.

  • In the Instance count section enter 2 (Indicating initial creation of 2 VMs). Then select Configure.

-Under the Scaling condition, click the Add a scaling condition

Scaling settings

Scaling condition

Scaling configuration

  • Set the parameters as indicated below.

Scaling options

Scaling options

  • Under Schedule select Specify start/end dates.

  • Select your time zone in the Timezone blade as well as the start date.

  • Click on the Save button

Scaling options

  • Under Instance details, select a marketplace image for Image. Select any of the Supported Distros.

  • Under the Size blade, select Standard_D2sv3 - 2 vcpus, 8 Gib memory.

  • Under Administrator account configure the admin username and set up an associated password or SSH public key. (In this demo, we will generate a new key pair.)

  • Next, set your username, and in the SSH public key source field, select RSA SSH Format.

  • Enter the Key pair name. In this demo the key name is vmssKey

VMSS

Account setting

  • Select Next: Disks to proceed to the Disk configuration options. For this quickstart, leave the default disk configurations.

  • Select Next: Networking to move to the networking configuration options.

  • On the Networking page, under Load balancing, select the Use a load balancer radio button to put the scale set instances behind a load balancer.

Load balancer

Load balancer

  • In the Select load balancer options, select Create load balancer.

  • Give the Load balancer a name - vmss-lb.

Load balancer

Load balancer

  • Click on Next to advance to the networking page and edit the network interface options as indicated below.

editing the network interface options

editing the network interface options

  • Review and create.

  • After it passes validation, select Create to deploy the scale set.

Validation passed

  • Select the Download private key and create resource

New key pair

  • After the deployment is completed, click on the Go to resource button.

deployment completed

  • Select Instances to see the two default VMs created as indicated in our configuration.

Instances

  • Go to the Load balancing blade and select the Frontend IP address.

  • Next step is to open commamd prompt (cmd) to connect via SSH to the VM.

Connecting to the VM

Connection succeeded

  • Update the VM and install the webserver using the linux commands.

sudo apt-get -y update
sudo apt-get -y install nginx

webserver page

Setting up a stressor for the VMs to test the scale sets

  • Adding a workload to the VMs
  • Type the linux command
sudo apt-get install stress-ng
Enter fullscreen mode Exit fullscreen mode
  • Linux Stress command
stress-ng --cpu 4 --tz -t 1024
Enter fullscreen mode Exit fullscreen mode

Image description

  • Another instance of the VM has been created due to the increase in workload.
💖 💪 🙅 🚩
laoluafolami
Olaolu' Afolami

Posted on June 26, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Choosing the Right Relational Database
undefined Choosing the Right Relational Database

November 29, 2024

Cloud Security for DevOps Teams
undefined Cloud Security for DevOps Teams

November 29, 2024

DevSecOps for Cloud Applications
undefined DevSecOps for Cloud Applications

November 29, 2024