Azure Virtual Machine Scale Set: How to Create and Connect using SSH
Celestina Odili
Posted on June 28, 2024
Table of Contents
Overview of Virtual Machine Scale Set (VMSS)
Creating Virtual Machine Scale Set
Connecting Virtual Machine Scale Set
Overview of Virtual Machine Scale Set (VMSS)
Azure Virtual Machine Scale Set is a service that makes it possible to create and manage a group of load balanced VMs. Tt can be configured manually or automatically to scale out (increase the number of VMs) or scale in (decrease the number of VMs) based on demand or a defined schedule. The benefits of scale sets include:
- Easy to create and manage multiple VMs.
Scale sets allow all VM instances to be created from the same base OS image and configuration. This makes it easy to create and manage many VMs without having to do extra configuration or network management.
- Provides high availability and application resiliency.
Running multiple VM instances and distribution across availability zones or fault domains makes the application highly available and fault tolerant. There will be little or no down time if any of the VMs have problem.
- Allows your application to automatically scale as resource demand changes.
With the auto scaling configuration, scale set can scale your application in or out in response to demand or schedule. This help to reduce cost for business owner and improve performance of the application leading to users' satisfaction.
- Works at large-scale
With scale set, you can have up to 600 VM instances for managed images and 1000 for standard marketplace images and custom images through the Azure Compute Gallery.
Creating Virtual Machine Scale Set
Step 1: Sign to portal.azure.com
Step 2: Create Virtual Machine Scale Set
Search for virtual machine scale set in the search box and select virtual machine scale sets.
Click Create on the virtual machine scale sets page. This will open the create a virtual machine scale set basic page.
Step 3: Fill the basic tab parameters.
Fill the information in the following category
Project detail
Scale set detail
Orchestration
Instance details
Administration account
Under Project details, select the subscription and resource group. Create a new resource group if you do not have existing one. Under scale set details, type a name for the scale set and select a region of your choice.
Under Orchestration, select the Uniform Orchestration mode, set security type to standard and set scaling mode to autoscaling and click configure.
On the scaling configuration page that opens, click add a scaling condition.
Give it a name, fill the conditions as needed and click save.
Ensure the condition added is selected on scaling configuration page and scale-in policy is set then save.
Under instance details, Select a marketplace image for Image. An example is Ubuntu Server 22.04 LTS-x64 Gen2. choose a size for the VM instance.
Under administrator account, select ssh public key, input your desired username and key pair name. You can use the default if you wish.
Step 4: Network Configuration
Go to networking tab, configure network interface and create a load balancer. A virtual network and network interface is created by default. Under network interface, click the edit icon to edit the network interface created for you.
Set the public inbound ports to allow selected ports and select ssh 22 and HTTP 80. Enable public IP address and click ok.
Ensure you check the editted network interface. Select Azure load balancer and click create a load balancer
Type a name for the load balancer. Take note of the start value for frontend port range under inbound NAT rules then click create.
Step 5: Review and Create
Click review and create, review the details and click create.
After it has been validated, a Generate new key pair window will open. Select Download Private key and create resource. This will download the .pem key pair to your local computer.
When deployment is completed, clicking Go to resource will take you straight to the VMSS. You can carry out additional configurations if need be and view the instances that are running.
Connecting Virtual Machine Scale Set
On your local computer, open ssh connection through the in-built app for writing command. Find out the right one for your computer OS and open it. Use command prompt or PowerShell for window. For MacOS, the default app is called terminal. In this guide, command prompt is used.
Step 1: Open Command Prompt
Search for CMD and run as an administrator. Running as an administrator will help to prevent restriction.
Step 2: Type SSH Command
At the prompt, type
ssh space -i space path to the private key (.pem file downloaded) space username@public IP address and press enter.
example,
ssh -i "C:\Users\HP\Documents\Tina files\Project_key.pem" azureuser@52.232.125.22
If you experience idle time out add -p and 50000 (frontend port starting value) to the command. When connecting for the first time, you will be prompted to check and verify the host keys fingerprint. type yes to continue.
When your connection is successful, you will get a welcome message.
Posted on June 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.