Overview
Step 1 - Sign into the Azure Portal
Step 2 - Navigate to the Virtual Machine Scale Sets Page
Step 3 - Create a VM Scale Sets (VMSS)
Step 4 - Configure Settings
Step 5A - Basic settings: Configure Auto scaling
Step 5B - Administrator Account
Step 6 - Spot Settings
Step 7 - Disks Settings
Step 8A - Networking settings: Configure NIC, VNET, Subnet & Public IP
Step 8B- Configure Load Balancer
Step 9 - Management Settings
Step 10 : Tags
Step 11 : Deployment
Step 12 - Accessing VM Instances
Step 13 - Clean up your Environment
Step 14: Conclusion
Introduction
According to https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview : To provide redundancy and improved performance, applications are typically distributed across multiple instances. Customers may access your application through a load balancer that distributes requests to one of the application instances. If you need to perform maintenance or update an application instance, your customers must be distributed to another available application instance. To keep up with extra customer demand, you may need to increase the number of application instances that run your application. With scale sets, all VM instances are created from the same base OS image and configuration. This approach lets you easily manage hundreds of VMs without extra configuration tasks or network management. The virtual machine scale sets scales out horizontally to accommodate more VMs when demand, traffic, and resources increase and scales back in when traffic decreases.
Step 1 : Sign in to the Azure portal:
Go to https://portal.azure.comand sign in with your Azure account credentials
Step 2 : Navigate to the Virtual Machine Scale Sets page:
Go to your search bar "Search" "Virtual machine scale sets" You can find it in the left-hand navigation menu
"Click on" the "Virtual Machine Scale Sets" option from the Azure services menu
Step 3:Create a new VM Scale Set:
"Click on" the "Create" button You'll be directed to the creation wizard
3a. Fill in all the settings as shown highlight below
Basics: "Choose" the "Subscription" you want to use for this VMSS
"Select" an existing "resource group" or "Create" a new one to group your VMSS resources logically
b. "Provide" a "unique name"
"Choose" the "Azure region" where you want to deploy your VMSS
"Choose" the "Availability Zone"
"Select" "Uniform"
Orchestration Modes: Uniform and Flexible
Uniform Orchestration, the standard mode, deploys and manages VMs that are identical in configuration. Flexible Orchestration offers a more diverse VM configuration setup within the same scale set
c. Choose" the "Security type" or configure the security features
"Select" the "Ubuntu Image" for your VM instances, such as Windows or Linux
"Select" "Size" opted for the free service
d. There are two main ways that an application can scale: Vertical scaling, also called scaling up and down, means changing the capacity of a resource. For example, you could move an application to a larger VM size Horizontal scaling, also called scaling out and in, means adding or removing instances of a resource. The application continues running without interruption as new resources are provisioned, If demand drops, the additional resources can be shut down cleanly and deallocated.
Manual scaling is reset by maximum and minimum number of instances used for
Autoscaling is the process of dynamically allocating resources to match performance requirements "Select" "Autoscaling" "Click on" "Configure"
e. Step 5 - Basic settings: Configure Auto scale default option
"Click on" "the Icon" Highlighted in a red box
a. The Right page will pop up, Define scaling rules based on metrics like CPU usage, network traffic, or custom metrics. "Select" "Auto scaling Mode" Initial instance count : It's a fixed "number" of VM instances to "Create " Instance limit Minimum: A fixed number of VM instances to remove Instance limit Maximum: Create as many VM instances are required to reach a desired maximum amount
b. Scale Out: CPU Threshold greater than: It's a percentage-based increase of VM instances. CPU Threshold Lesser than: It is a percentage-based decrease of VM instances
Query duration: It's takes a minimum of 5 minutes to update the capacity of your scale set. "Select" "Preferred Time"
"Click on " the "Save"
c. Optionally, configure auto-scaling rules based on metrics
d. Scale Policy "Choose" "Default Setting"
"Click on" "Save"
Step 5B. Administration account: Use password to authenticate "Select" "Password"
"Create" "Username" "Create" "Password" "Click on" "Next: Spot"
Step 6. Spot Settings: To manage cost for demo purposes all of the spot setting will be left on Default
Step 7. "Click on" "Next: Disks"
a. Os disk: "Select" "Default Image" "Select" "Standard SDD"
b. Platform-managed key are keys generated, stored and managed entirely by Azure. Create and attach and add a new Disk if the temporary disk provided has exceeded its capacity "Select" "Platform-managed key" "Click on" "Next: Networking"
Step 8A. Configure networking settings, such as virtual network, subnet, Network Interfaces (nic)and load balancer options "Select" or "Create" "Virtual network"
a. Configure the VNET and create a public IP address "Click on" the pencil in a highlighted red box "
b. Allow default setting "Subnet" "NIC" "Public Inbound Port"
c. Inbound port: Hypertext Transfer Protocol (HTTP), a widely used internet communication protocol, has port 80 assigned to it. "Select" "Http 80"
"Enabled" "Public IP address" "Click on" "OK"
Step 8B. By speeding up application response times and cutting down on network latency, load balancers enhance application performance "click on" the "Azure load balancer" "Click on" "Create a load balancer"
a. Fill in the details on the right side of the page :The distinctions between TCP and UDP protocols. Transmission control protocol (TCP) and user datagram protocol (UDP) differ primarily in that UDP is a connectionless protocol while TCP is connection-based. Although TCP transfers data more slowly, it is more dependable. UDP operates faster but is less dependable "Create" "Load balancer name" Type "Click on" "Public" "Click on" "TCP"
b. A load balancer rule defines how incoming traffic is divided across all instances in the backend pool. A load-balancing rule assigns a single frontend IP configuration and port to numerous backend IP addresses and ports.
Rules "Check" "Load balancer" and "Check" "Inbound NAT rule"
Leave Port and Backend port as "Default"
c. An inbound NAT rule directs traffic from a load balancer frontend to one or more instances in the backend pool
"Click on" "Create"
d. Load balancer has been created and configured "Click on" "Next: Management"
Step 9. Management Settings: There are three different modes an Upgrade Policy can be set to. The modes are Automatic, Rolling and Manual. The upgrade mode you choose can impact the overall service uptime of your Virtual Machine Scale Set.
"Select" "Automatic"
a. Azure Monitor Metrics is a time-series database, optimized for analyzing time-stamped data. Azure Monitor collects metrics at regular intervals. Identity You can use managed identities to authenticate to any resource that supports Microsoft Entra authentication, including your own applications. Managed identities can be used at no extra cost. Note: Managed identities for Azure resources is the new name for the service formerly known as Managed Service Identity (MSI).
b. (Optional): Set up Azure Monitor for the VM Scale Set to collect telemetry data and gain insights into its performance. Health , Advanced setting will be left on default setting. After filling in all the necessary details, review your settings to ensure everything is configured correctly. Once you're satisfied, "Click on" 'review + Create"
Step 10. Tags: Always Tag your work In Microsoft Azure, tags are metadata labels that you can assign to Azure resources like virtual machines, storage accounts, databases, etc. They also enable you to logically organize resources, track costs, and implement access controls, among other things.
Step 11 - Deployment: Wait for Azure to deploy the VM Scale Set. The deployment might take a few minutes depending on the configuration and the number of instances you specified. Azure will validate your configuration, and if everything checks out, you can proceed to deploy your Virtual Machine Scale Set by clicking on the "Create" button.
a. Deployment is in progress: Below in the image are the resources created are highlighted below in the Image
b. Deployment complete: Once the deployment is complete, you can monitor the health and performance of your VMSS from the Azure Portal "Click on" "Go to resource"
Step 12 - Accessing VM Instances : We have successfully created 4 working Instances
a. Running Instances
Step 12 - Connect to VM Instances: Once the deployment is complete, you can access the individual VM instances within the scale set using SSH (for Linux) or Remote Desktop (for Windows) as you would with any regular VM in Azure. Follow link to help guide you connect to your VM https://ladyintech.hashnode.dev/starters-guide-to-creating-a-linux-virtual-machine-on-azure
Step 13. Clean up your Environment : Identify and remove any unused or unnecessary resources, including virtual machines, storage accounts, databases, and other services. This helps to cut costs and improve resource management. This process is important for many reasons, including cost optimization, security, and overall efficiency.
Conclusion
Azure's Virtual Machine Scale Sets offer a versatile and scalable option for efficiently managing a collection of virtual machine instances. By following the steps provided in this article, you can simply create and maintain VMSS through the Azure Portal, allowing your applications to grow seamlessly based on demand. Whether you're running a small online application or a large-scale business solution, VMSS can help you reach peak performance and cost efficiency in the cloud.
Lady In Tech