Load Balance VMs Within An Availability Zone by Using The Azure Portal

You might also like

Download as pdf
Download as pdf
You are on page 1of 15
1125124, 738 PM utoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam: Tutorial: Load balance VMs within an availability zone by using the Azure portal Article + 12/05/2023 This tutorial creates a public load balancer with a zonal IP. In the tutorial, you specify a zone for your frontend and backend instances. In this tutorial, you learn how to: Y Create a virtual network with an Azure Bastion host for management. Y Create a NAT gateway for outbound internet access of the resources in the virtual network. VY Create a load balancer with a health probe and traffic rules. Y Create zonal virtual machines (VMs) and attach them to a load balancer. Y Create a basic Internet Information Services (IIS) site. Y Test the load balancer. For more information about availability zones and a standard load balancer, see Standard load balancer and availability zones. Prerequisites * An Azure subscription Sign in to Azure Sign in to the Azure portal Create a virtual network and bastion host In this section, you creates a virtual network with a resource subnet, an Azure Bastion subnet, and an Azure Bastion host. © Important nitps:leam microsof.comlen-usfazurelload-balancertuoriatoad-balancer-standars-pudle-zonal-portal 15 1125124, 7:38 PM utoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam Hourly pricing starts from the moment that Bastion is deployed, regardless of outbound data usage. For more information, see Pricing and SKUs. If you're deploying Bastion as part of a tutorial or test, we recommend that you delete this resource after you finish using it. 1. In the portal, search for and select Virtual networks. 2. On the Virtual networks page, select + Create. 3. On the Basics tab of Create Setting Project details Subscription Resource group Instance details Name Region tual network, enter or select the following information: © Expand table Value Select your subscription. Select Create new. Enter load-balancer-rg in Name Select OK. Enter Ib-vnet. Select East US. nitps:leam microsof.comlen-ustazurelload-balancertutoria4oad-balancer-standars-pudle-zonal-portal ans “125124, 7:38 PM ‘Tutorial: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Lea re t a « ° © & Home > Vinual networks Create virtual network x Basics Secunty Padkhesser Tage Review +ceate Asie Vital Net (ie the fundamental buleing Rack fr you pte networkin Azur Neen may pst of ‘aur esoutces, such 35 ze Virtual Machies (M1 Securely Communit wth exh ote, tb erat ahd on-premises rensvts avis rare # radon natn ta os open your ou ots arta bengswth sons tenets oF Azure'sinanictie seh as sc asi and oer Project deta Sele the sabeciption to mange dpe escctes an cos Ut resource goup ie rete orgie ane manage all sutrpton ae ¥ l . rescue group (Ne oa ce ¥ ‘Vetus network nme lbamet region © * eeus ~ 4, Select the Security tab or Next button at the bottom of the page. 5. Under Azure Bastion, enter or select the following information: <2 Expand table Setting Value Azure Bastion Enable Azure Bastion Select checkbox Azure Bastion host name Enter Ib-bastion. ‘Azure Bastion public IP address Select Create new. Enter Ib-bastion-ip in Name. hntps:leam mierosof.conver-usiazurelload-Dalancertuteia-load-balancer-standare-puble-zonal-portal 35 1125124, 738 PM Tutoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam Setting Value Select OK. 6, Select the IP addresses tab, or Next at the bottom of the page. 7. On Create virtual network page, enter or select the following information: Setting ‘Add IPv4 address space IPv4 address space Subnets Subnet template Name Starting address Subnet size Security NAT Gateway 2 Expand table Value Enter 10.0.0.0/16 (65,356 addresses) Select the default subnet link to edit. Leave the default Default Enter backend-subnet. Enter 10.0.0.0. Enter /24(256 addresses), Select Ib-nat-gateway. nitps:leam microsof.comlen-ustazurelload-balancertutoria4oad-balancer-standars-pudle-zonal-portal ans “125124, 7:38 PM “Tutorial: Load balance VMs within an availabilty zone - Azure portal -Azure Load Balancer | Microsoft Lea Edit subnet x Select an address space and configure your subnet, You can customize a defeult subnet or select from subnet templates if you plan to add select services later. Learn more c IP address space @ Subnet details Subnat template © Name~@ Starting address * © Subnet size @ IP address space @ ‘Security 0.0.00, 10.0.0.0- 10.0.255.255 (65536 addresses) Default v backend-subnet ] (Fone 7/24 (256 addresses) v| 10.0.0 - 100.0255 (256 addresses) Simplify internet access for virtual machines by using a network address translation gateway. Filter subnet traffic using 2 network security group. Learn more © NAT gateway © Network security group © Route table 8, Select Save. b-nat-gateway v create new None v Create new None v 9. Select Review + create at the bottom of the screen, and when validation passes, select Create. hntps:leam microsoft. conver-us/azurelload-Dalancetutoia-load-balancer-standare-puble-zonal- portal 515 1125124, 738 PM Tutoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam: Create NAT gateway In this section, you'll create a NAT gateway for outbound internet access for resources in the virtual network, For other options for outbound rules, check out Network Address Translation (SNAT) for outbound connections 1. Sign in to the Azure portal 2. In the search box at the top of the portal, enter NAT gateway. Select NAT gateways in the search results. 3, Select + Create. 4.In the Basics tab of Create network address translation (NAT) gateway enter or select the following information: (2 Expand table Setting Value Project details Subscription Select your subscription Resource group Select Create new Enter load-balancer-rg in Name. Select OK. Instance details NAT gateway name Enter Ib-nat-gateway. Region Select East US. Availability zone Select None. Idle timeout (minutes) Enter 15. nitps:leam microsof.comlen-ustazurelload-balancertutoria4oad-balancer-standars-pudle-zonal-portal ens “125124, 7:38 PM 10. nN 12. 13, “Tutorial: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Lea Home > NAT gateways Create network address translation (NAT) gateway x t = 4+ Ravens gon nb sed oat ouound fos fo it retro th pub nert a = : cy Petes Sec bicpsonemahge dpe eos and cons i esses ik test orice and manage ot B_ —_yourresources. * subsaigtion® [sre sitecrpton s Resource group* (rea tae bance rg = < caeree a Instance des e © ras gnevo ane Redon as = fat oie =z © reritetine ine * ‘a aaa Select the Outbound IP tab or select the Next: Outbound IP button at the bottom of the page. . Select Create a new public IP address under Public IP addresses. . Enter nat-gw-public-ip in Name in Add a public IP address. . Select OK. . Select the Subnet tab or select the Next: Subnet button at the bottom of the page. On the Subnet page, for Virtual network, select Ib-vnet from the dropdown. For Subnet name, select backend-subnet. Select the blue Review + create button at the bottom of the page, or select the Review + create tab. Select Create. hntps:leam microsoft. conver-us/azurelload-Dalancetutoia-load-balancer-standare-puble-zonal- portal 78 1125124, 738 PM Tutoria: Load balance VMs within an availabilty zone - Azure poral - Azure Load Balancer | Microsoft Loam: Create load balancer In this section, you create a load balancer for the virtual machines. 1. In the search box at the top of the portal, enter Load balancer. Select Load balancers in the search results. 2. In the Load balancer page, select Create or the Create load balancer button. 3. In the Basics tab of the Create load balancer page, enter, or select the following information: Setting Project details Subscription Resource group Instance details Name Region sku Type Tier © expand table Value Select your subscription, Select Ib-resource-group. Enter load-balancer Select (US) East US. Leave the default Standard. Select Public. Leave the default Regional 4, Select the Frontend IP configuration tab, or select the Next: Frontend IP configuration button at the bottom of the page. 5. In Frontend IP configuration, select + Add a frontend IP configuration 6. Enter Ib-frontend-IP in Name. 7. Select IPv4 or IPv6 for the IP version. © Note nitps:leam microsot.comlen-usfazurelload-balancertuoriatoad-balancer-standars-pudle-zonel-portal ans 11254, 7:98 Pa Tutor: Load balance VMs win an availabilty zone - Azure portal - Azure Load Balance | Micros Leam IPv6 isn't currently supported with Routing Preference or Cross-region load- balancing (Global Tier). 8, Select IP address for the IP type. © Note For more information on IP prefixes, see Azure Public IP address prefix. 9, Select Create new in Public IP address. 10. In Add a public IP address, enter Ib-public-IP for Name. 11, Select Zone-redundant in Availability zone. © Note In regions with Availability Zones, you have the option to select no zone (default option), a specific zone, or zone-redundant. The choice will depend on your specific domain failure requirements. In regions without Availability Zones, this field won't appear. For more information on availability zones, see Availability zones overview. 12, Select OK. 13. Select Add. 14, Select the Next: Backend pools> button at the bottom of the page. 15. In the Backend pools tab, select + Add a backend pool. 16, Enter Ib-backend-pool for Name in Add backend pool 17. Select Ib-VNet in Virtual network. 18, Select IP Address for Backend Poo! Configuration and select Save. 19. Select the Inbound rules tab, or select the Next: Inbound rules button at the bottom of the page. 20. In Load balancing rule in the Inbound rules tab, select + Add a load balancing rule. nitps:leam microsof.comlen-ustazurelload-balancertuoiatoad-balancer-standars-pudle-zonal-portal sins 1125124, 738 PM utoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam 21. In Add load balancing rule, enter or select the following information: <2 Expand table Setting Value Name Enter Ib-HTTP-rule IP Version Select IPv4 or IPv6 depending on your requirements. Frontend IP address Select Ib-frontend-IP. Backend pool Select Ib-backend-pool. Protocol Select TCP, Port Enter 80. Backend port Enter 80. Health probe Select Create new. In Name, enter Ib-health-probe. Select HTTP in Protocol, Leave the rest of the defaults, and select Save. Session persistence Select None. Idle timeout (minutes) Enter 15 Enable TCP reset Select checkbox Enable Floating IP Select checkbox. Outbound source network _Leave the default of (Recommended) Use outbound rules to address translation (SNAT) _provide backend pool members access to the internet. 22. Select Save. 23, Select the blue Review + create button at the bottom of the page. 24, Select Create. © Note In this example we created a NAT gateway to provide outbound Internet access. The outbound rules tab in the configuration is bypassed as it's optional and isn't nitps:leam microsot.comlen-usfazurelload-balancertuoriatoad-balancer-standars-pudle-zonel-portal 1015 1125124, 738 PM Tutoria: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam: needed with the NAT gateway. For more information on Azure NAT gateway, see What is Azure Virtual Network NAT? For more information about outbound connections in Azure, see Source Network Address Translation (SNAT) for outbound connections. Create virtual machines In this section, you create two VMs (Ib-vm1 and Ib-VM2) in a single zone (Zone 1) These VMs are added to the backend pool of the load balancer that was created earlier. 1. In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results, 2. In Virtual machines, select + Create > Azure virtual machine, 3. In Create a virtual machine, enter or select the following values in the Basics tab: Setting Project Details Subscription Resource Group Instance details Virtual machine name Region Availability Options Availability zone Security type Image ‘Azure Spot instance Size © Expand table Value Select your Azure subscription Select load-balancer-rg Enter Ib-VM1 Select ((US) East US) Select Availability zones Select Zone 1 Select Standard. Select \dows Server 2022 Datacenter: Azure Edi Leave the default of unchecked. Choose VM size or take default setting nttps:leam microsof.comlen-ustazurelload-balancertuoria-toad-balancer-standars-pudle-zonal-portal 15 1125124, 738 PM Tutorial: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam Setting Administrator account Username. Password Confirm password Inbound port rules Public inbound ports Value Enter a username Enter a password Reenter password Select None 4, Select the Networking tab, or select Next: Disks, then Next: Networking. 5. In the Networking tab, select or enter the following information: Setting Network interface Virtual network Subnet Public IP NIC network security group Configure network security group Delete NIC when VM is deleted Accelerated networking Load balancing Load balancing options Load-balancing options Select a load balancer (2 Expand table Value Select b-vnet Select backend-subnet Select None. Select Advanced Skip this setting until the rest of the settings are completed, Complete after Select a backend pool Leave the default of unselected Leave the default of selected, Select Azure load balancer Select load-balancer nitps:leam microsof.comlen-ustazurelload-balancertuoiatoad-balancer-standars-pudle-zonal-portal sans 1125124, 738 PM Tutorial: Load balance VMs within an availabilty zone - Azure portal - Azure Load Balancer | Microsoft Loam Setting Value Select abackend pool _ Select Ilb-backend-pool Configure network Select Create new. security group In the Create network security group, enter Ib-NSG in Name Under Inbound rules, select +Add an inbound rule. In Service, select HTTP. Under Priority, enter 100. In Name, enter Ib-NSG-Rule Select Add Select OK 6. Select Review + create. 7. Review the settings, and then select Create. 8, Follow the steps 1 through 7 to create another VM with the following values and all the other settings the same as Ib-VM1 2 Expand table Setting vM2 Name Ib-VM2 Availability zone Zone 1 Network security group Select the existing Ib-NSG © Note Azure provides a default outbound access IP for VMs that either aren't assigned a public IP address or are in the back-end pool of an internal basic Azure load balancer. The default outbound access IP mechanism provides an outbound IP address that isn't configurable The default outbound access IP is disabled when one of the following events happens: * A public IP address is assigned to the VM * The VM is placed in the back-end pool of a standard load balancer, with or without outbound rules. nttps:leam microsof.comlen-ustazurelload-balancertutoria-toad-balancer-standars-pudle-zonal-portal 1915 11254, 7:98 Pa Tuoi: Load balance VMs win an availabilty zone - Azure portal - Azure Load Balance | Micros Leam * An Azure Virtual Network NAT gateway resource is assigned to the subnet of the VM. VMs that you create by using virtual machine scale sets in flexible orchestration mode don't have default outbound access. For more information about outbound connections in Azure, see Default outbound access in Azure and Use Source Network Address Translation (SNAT) for outbound connections. Install IIS 1. Select All services in the left-hand menu, select All resources, and then from the resources list, select Ib-VM1 that is located in the load-balancer-rg resource group. 2. On the Overview page, select Connect, then Bastion. 3. Select Use Bastion. 4, Enter the username and password entered during VM creation. 5, Select Connect. 6. On the server desktop, navigate to Windows Administrative Tools > Windows PowerShell. 7. In the PowerShell Window, run the following commands to: © Install the IIS server * Remove the default iisstart.htm file * Add a new iisstart.htm file that displays the name of the VM Powershell # Install IIs server role Install-WindowsFeature -name Web-Server -IncludeManagementTools # Remove default htm file Remove-Item C:\inetpub\wwwroot\iisstart htm # Add anew htm file that displays server nane nitps:leam microsof.comlen-usfazurelload-balancertuoria-oad-balancer-standars-pude-zonal-portal sais 1125124, 7:38 PM Tuto Load balance VMs within an avalailty zane - Azure portal - Azure Load Balancer | Microsoft Leam Add-Content -Path “C:\inetpub\wwwroot\iisstart.htm” -Value $("Hello World from " + $env:computernane) 8. Close the Bastion session with Ib-VM1 9, Repeat steps to install IIS and the updated iisstart.htm file on Ib-VM2. Test the load balancer 1. In the search box at the top of the page, enter Load balancer. Select Load balancers in the search results. 2. Click the load balancer you created, load-balancer. On the Frontend |P configuration page for your load balancer, locate the public IP address. 3. Copy the public IP address, and then paste it into the address bar of your browser. The custom VM page of the IIS Web server is displayed in the browser. BD arises xt < GA Nersecure | 20210710008 8 Hello World fiom myVMI Clean up resources When no longer needed, delete the resource group, load balancer, and all related resources, To do so, select the resource group load-balancer-rg that contains the resources and then select Delete. Next steps Advance to the next article to learn how to load balance VMs across availability zones: nitps:leam microsof.comlen-ustazurelload-balancertutoria4oad-balancer-standars-pudle-zonal-portal 155

You might also like