Azure Virtual Machine Scale Set: How to Create and Connect using SSH

Celestina OdiliCelestina Odili
4 min read

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.

Image description

Click Create on the virtual machine scale sets page. This will open the create a virtual machine scale set basic page.

Image description

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.

Image description

Under Orchestration, select the Uniform Orchestration mode, set security type to standard and set scaling mode to autoscaling and click configure.

Image description

On the scaling configuration page that opens, click add a scaling condition.

Image description

Give it a name, fill the conditions as needed and click save.

Image description

Image description

Image description

Ensure the condition added is selected on scaling configuration page and scale-in policy is set then save.

Image description

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.

Image description

Under administrator account, select ssh public key, input your desired username and key pair name. You can use the default if you wish.

Image description

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.

Image description

Set the public inbound ports to allow selected ports and select ssh 22 and HTTP 80. Enable public IP address and click ok.

Image description

Ensure you check the edited network interface. Select Azure load balancer and click create a load balancer.

Image description

Type a name for the load balancer. Take note of the start value for frontend port range under inbound NAT rules then click create.

Image description

Step 5: Review and Create

Click review and create, review the details and click create.

Image description

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.

Image description

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.

Image description

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 and 52.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.

Image description

  • When your connection is successful, you will get a welcome message.

Image description

0
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