DEV Community

Cover image for Tutorial to Create a Virtual Machine Scale Set in Microsoft Azure.
Ikponmwonsa Okundigie
Ikponmwonsa Okundigie

Posted on

Tutorial to Create a Virtual Machine Scale Set in Microsoft Azure.

In the world of cloud scalability, Microsoft Azure's Virtual Machine Scale Sets (VMSS) are revolutionary. This guide will show you how to set up a VMSS using the Microsoft Azure Portal, step by step. Let's begin!

Step 1
Sign in to the Azure Portal at https://portal.azure.com.

Step 2
Go to the home page and click on the + Create or use an existing resource icon.

Image description

Step 3
Navigate to the search bar, look for virtual machine scale set and select it. Click on Create and then select Virtual machine scale set to go to the Create a virtual machine scale set page.

Image description

Step 4
On the Basic tab, choose the relevant subscription and resource group under Project details
Image description

Step 5
Provide a name for the VMSS, select your preferred region, and choose an availability zone under Scale set details.

Image description

Step 6
Under Orchestration Mode, ensure the Uniform option is selected, security type, Standard is selected and Scaling to Autoscaling
Image description

Step 7
Scaling Configuration
Click on Configure to get details of scaling configuration.
Image description

click + add a scaling condition and create a scaling condition name
Image description

Select mode to Autoscaling, type your initial instance, instance limit, scale out or in, query duration and your schedule then save.

Image description

Image description

Predictive Scaling: click on checkbox to enable forecast for predictive autoscaling
Scaling in policy: Newest VM- Balance across zone then delete the newest created VM and save your configuration.

Image description

Step 8
Instance Details
Image, in this example, we have chosen Ubuntu Server 20.04 LTS - x64 Gen2, VM architecture, and size according to your needs

Image description
Enter your desired username, and select which authentication type you prefer for administrator account

Image description

Select Next: Spot set as default.
Select Next: Disks to move the disk configuration options. For this quickstart, leave the default disk configurations.

Select Next: Networking to move the networking configuration options.
Edit network interface, select your inbound port HTTP (80), SSH (22), then click on enable IP address and press OK

Image description

Click on the checkbox to the virtual network interface.
Image description

Image description

On the Networking page, under Load balancing, select the Use a load balancer checkbox to put the scale set instances behind a load balancer. In Load balancing options, select Azure load balancer. In Select a load balancer, select your load balancer or create a new one.

Image description

Step 9
Click on Review + create to proceed. After it passes validation, select Create to deploy the scale set.
Image description

Now you will see that the VMSS has been deployed successfully.
Image description

Step 10

On a Windows machine, search for a command prompt and click Run as administrator

Image description

Click on your download to get your key file and ensure you note the download location of the .PEM file, then you right click on your .PEM File and select on Properties to locate your file path as you will need its path in the next step.

Image description

For connection you will need your command prompt, username and the IP address to run on your terminal. In your command prompt, initiate an SSH connection to your virtual machine and substitute the VM's IP address for the placeholder, and replace the file path with the actual path where the key file was downloaded.(ssh -i "/path/to/your/private-key-file.pem" username@your-vm-public-ip- p 50000)

Image description

Clean up resources
When no longer needed, delete the resource group, scale set, and all related resources. To do so, select the resource group for the scale set and then select Delete.

Top comments (0)