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
Set number of VM’s,instance size,public IP name,allocation methpd and domain name
We can also specify number of placement groups
Next, we need to set Virtual Machine scale set name,choose OS image and specify resource group
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
To make RDP to instance click on Load balancers-Inbound NAT rule to see port for connection
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: