Azure Virtual Machine Scale Set: How to Create and Connect using SSH
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. It 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.
- Provides high availability and application resiliency.
- Allows your application to automatically scale as resource demand changes.
- Works at large-scale
Continue reading to learn how to create a virtual machine scale set.
Creating Virtual Machine Scale Set
Step 1: Sign to portal.azure.com
sign in with your credential or create a free account if you do not have one.
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 edited 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 and continue with deploying your resources.
When deployment is completed, clicking Go to resource will take you to the VMSS overview page. You can carry out additional configurations if need be and view the instances that are running.
Connecting Virtual Machine Scale Set
Step 1: Open ssh Connection
On your terminal (for example, command prompt, PowerShell, bash), open ssh connection.
Step 2: Type SSH Command
Run the following command replacing
"C:\Users\HP\Documents\Tina files\Project_key.pem"
with the path to your key pair and the name,azureuser
with your username and52.232.125.22
with your-publicIP-address.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.
Subscribe to my newsletter
Read articles from Celestina Odili directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Celestina Odili
Celestina Odili
Computer Scientist/ Cloud Engineer/DevOps Engineer / Technical writer