In this section, we will show how to leverage an Amazon Application Load Balancer (ALB) with VMware VMs.
In this scenario, we have four (4) front-end apache servers running in a VMware SDDC. These do not have any public IP addresses associated with them and no NAT’ing configured. These VMs will connect to an AWS Application Load Balancer (ALB) that will route to the internal IP addresses of the VMware VM’s even though they do not reside within the VPC of the Load Balancer.
As you can see below, the four apache servers (BG-Frontend-Apache-0(1-4)) are sitting in the VMware Cloud on AWS SDDC.
Taking a look at each of these virtual machines you will notice that they all have private IP addresses (192.168.5.21-24). This is important to understand as you move forward. Keeping track of their private IP addresses, move on to create the target group that will be used by the AWS Application Load Balancer. (*Note: The firewall and security group rules were setup in the previous blog posts.)
In this example, the AWS Console, under EC2 > Load Balancing > Target Groups, has a target group created for these Apache VMs. When registering the targets, instead of pointing them to a VPC, they are pointed to ‘Other Private IP’. After populating each IP address for the four VMs, you should see a 'healthy' status by each target.
Now that the target group that our Application Load Balancer will consume is set up, you can go ahead and create the Load Balancer. Creating an Application Load Balancer (ALB) is very straightforward so every step of that process will not be discussed here. Ensure that the VPC that is chosen at creation is the VPC that is connected to your VMC SDDC. Also, add port 80 to your target group as a ‘Listener’.
Once created, this ALB gives us an address of: alb-vmc-356827325.us-west-2.elb.amazonaws.com (feel free to try out the link!) Each of the Apache VMs are running a simple static website with a title, the name of the VM, and an image of the VMware Cloud on AWS overview slide. Once you are on this page, try refreshing multiple times and you will see that it is hitting each of the different VMs from the Target Group.
You no longer need to deploy your own software load balancer in the VMware stack. There is no additional updating or maintenance to be performed with your load balancer as you are now using one provided by AWS. Remember, all of these Apache VMs were using their private IP addresses and did not have to configure additional NAT’ing rules or add Public IPs to resolve these VMs. They are all leveraging the Elastic Network Interface (ENI) connectivity between the VMware stack and their AWS services. Something you won’t find anywhere else. This opens up endless possibilities for customers to design and implement their datacenter application architecture.