Create a Virtual Machine Scale Set in Azure

Posted: October 16, 2017 in Azure

A virtual machine scale set allows us to deploy and manage a set of identical, auto-scaling virtual machines. We can scale the number of VMs in the scale set manually, or define rules to autoscale based on resource usage such as CPU, memory demand, or network traffic.

In Azure portal click new-type wmss

1

Set number of VM’s,instance size,public IP name,allocation methpd and domain name

1-1.PNG

We can also specify number of placement groups

1-2

Next, we need to set Virtual Machine scale set name,choose OS image and specify resource group

2

Specify maximum number of VM’s,scale out settings (if CPU usage exceeds 75 % a 1 machine will be added if it fails below 75 %, 1 will be removed

3

To make RDP to instance click on Load balancers-Inbound NAT rule to see port for connection

Capture.PNG

 

1.PNG

 

Let’s say we installed IIS on one instance, how can we access to it:

#get load balncer
$lb=Get-AzureRmLoadBalancer -Name myscalesetLb -ResourceGroupName myrg1

Create a frontend IP pool
$lbfec=Get-AzureRmLoadBalancerFrontendIpConfig -LoadBalancer $lb

#get a backend ip pool
$bep=get-AzureRmLoadBalancerBackendAddressPoolConfig -Name bepool -LoadBalancer $lb

# Create a load balancer health probe on port 80
Add-AzureRmLoadBalancerProbeConfig -Name myHealthProbe -LoadBalancer $lb -Protocol tcp -Port 80 -IntervalInSeconds 15 -ProbeCount 2

# Create a load balancer rule to distribute traffic on port 80
Add-AzureRmLoadBalancerRuleConfig -Name myLoadBalancerRule -LoadBalancer $lb -FrontendIpConfiguration $lb.FrontendIpConfigurations[0] -BackendAddressPool $lb.BackendAddressPools[0] -Protocol Tcp -FrontendPort 80 -BackendPort 80

# Update the load balancer configuration
Set-AzureRmLoadBalancer -LoadBalancer $lb

 

Try to access from the outside by IP or DNS name:

 

7.PNG

 

8.PNG

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s