How to Create a VMSS from Captured image on Azure
Tags: azure, aws, gcp, hagital
Published: 2023-08-31 05:22:03

In the cloud tech space, scalability is essential. Whether you're a startup, gearing up for rapid growth or an established enterprise managing variable workloads, Azure Virtual Machine Scale Sets (VMSS) can be a game-changer. This versatile Azure service allows you to effortlessly manage and scale multiple virtual machines (VMs) while ensuring high availability and ease of management.

Today we shall journey through creating a VMSS from a compute gallery in the Azure Portal, unlocking the potential for your applications to scale dynamically.

**VMSS and Compute Gallery**
**VMSS** is an Azure service that lets you deploy and manage a set of identical VMs. Combining these two technologies allows you to scale applications horizontally by deploying VMs based on custom images from your gallery.

**Azure Compute Gallery** is a powerful feature that allows you to create and manage custom virtual machine images. These images can include your desired operating system, applications, and configurations. 

See my article to [Create Azure Compute Gallery and capture image] (https://dev.to/samuel_olo75614/how-to-create-a-compute-gallery-and-capture-vm-images-52f3)

**Benefit of Azure Virtual Machine Scale Set**
Azure Virtual Machine Scale Sets (VMSS) offer several benefits for managing and deploying virtual machines in Microsoft Azure:

- High Availability
- Scalability
- Automatic Updates
- Custom Images
- Managed Disks
- Auto Scaling
- Integrated Monitoring
- Cost-Efficiency
- Ease of Management
- Rolling Upgrades
- Template-Based Deployment
- Integration with Azure DevOps
- Global Deployment

Before you begin, ensure that you have the following prerequisites in place:

**Azure Subscription:** You need an active Azure subscription. If you don't have one, you can sign up for a free trial at Azure Portal.

**Azure Resource Group:** Create an Azure Resource Group to organize and manage your gallery resources.

**Azure Compute Gallery:** Make sure you have created a compute gallery and have captured the image of the VM you want to scale. Click here to learn how to create a compute gallery and capture a VM.

***Creating a VM Scale Set***
Login to the Azure Portal home page.
Go to " Azure Compute galleries" where the image is stored.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7vhyc79yfpm6yjzbagk.png)

Click on Create VMSS

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ip6s9oqcawgju86j5we8.png)

or Search for VMSS on the search bar above from your Azure portal homepage.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/164za4928kwk9j5piuhg.png)

Click on the create button
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ui4rqf4p7m9iu0srpo4.png)

**Basics:** Fill out the basic information, such as the subscription, resource group, and region. Give your VMSS a unique name.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hefyu63cvzkml34kk75m.png)

**Orchestration:** The orchestration mode is defined when you create the scale set and cannot be changed or updated later. There are two types in Azure, the Uniform and flexible orchestration. Scale sets with Uniform orchestration is Optimized for large-scale stateless workloads with identical instances while Scale sets with Flexible orchestration is used to achieve high availability at scale with identical or multiple virtual machine types.

Select the 'Flexible orchestration'; With Flexible orchestration, Azure provides a unified experience across the Azure VM ecosystem. Flexible orchestration offers high availability guarantees (up to 1000 VMs) by spreading VMs across fault domains in a region or within an Availability Zone. This enables you to scale out your application while maintaining fault domain isolation that is essential to run quorum-based or stateful workloads.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c2b4ew7vjm1jcnx7ffsb.png)

**Instance Details:** Configure instance details, such as the VM image, VM architecture and instance size, select the 'gallery image' you created earlier.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41q789n4ngzawtjvknub.png)

This will automatically select the VM architecture and VM size that was used in the VM we captured in our compute gallery.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i64e4lj53sojwyw6qti1.png)

**Administrator Account:** This is where you setup the username and password of your VMSS, but because we selected the Specialized operating system state when we captured the VM image it is grayed out because we no longer need authentication when we want to scale out.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8nvnme2ioj8n9z5zuvpu.png)

**Scaling:** Configure scaling options based on your application needs. Select 'Custom scaling' so that you can define scaling rules for automatic scaling. Here we define;

initial instance count to 3.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhbz8ebrpk374y7cj7qh.png)

minimum number of instances to 1
maximum number of instances to 10
the VMSS to scale out in 5 minutes once the CPU threshold gets to 75% by 2 instances.
the VMSS to scale in, in 5 minutes once the CPU threshold gets to 25% by 1 instances.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xqzn3pc0pnv1rk0d7za.png)

Management: Specify monitoring, diagnostics, and auto-shutdown settings as per your requirements or leave it on default.

Tags: Ensure that your resources are tagged, you can add tags based on your preference.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oe5z5mw3no8p2iwn1xye.png)

Review + Create: Review your settings, and when everything looks good, click 'Create' to deploy your VM Scale Set. This will take a while, once deployment is completed, click on 'Go to resource' to access the newly created VMSS.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wh4f2yvj28lre0r9gtir.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ougr2vj7kjm3w6inpl2k.png)

Go to Resource

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2pu7542ryhj9udxo145.png)

This is the newly deployed Virtual Machine Scale Set, and you can see the initial instance defined during configuration are already running.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0acsnaxqun4n4yi99pd7.png)

**Monitor and Manage Your VMSS**

Once your VMSS is deployed, you can use Azure Monitor and Azure Autoscaling to ensure your application scales efficiently and is highly available. Azure Monitor helps you gain insights into your VMSS's performance, while Autoscaling allows you to automate scaling based on metrics and schedules.

**Summary**

In this comprehensive guide, we've explored the process of creating a Virtual Machine Scale Set (VMSS) from a custom image in Azure Compute Gallery. By leveraging these Azure services, you can optimize the scalability and availability of your applications, ensuring they can handle varying workloads with ease.

VMSS and Compute Gallery are indispensable tools in your cloud infrastructure toolbox, empowering you to deploy, manage, and scale virtual machines efficiently. As you embark on your cloud journey, remember that flexibility and scalability are your allies, and Azure is your trusted partner in achieving your goals.

Embrace the power of Azure VMSS and Compute Gallery to unlock the true potential of your cloud applications. Scale up, scale out, and scale confidently with Microsoft Azure.

_Thank you for reading my article till the end. I hope you learned something special today. If you enjoyed this article, then please share to your friends and if you have suggestions or thoughts to share with me then please write in the comment box._