Using AWS Application Load Balancer for Blue / Green Application Migration to VMware Cloud on AWS

5 minute read
Content level: Advanced

The purpose of this article is to provide an example on how to migrate applications to VMware Cloud on AWS without requiring migration of the underlying virtual machines. This can provide the ability to migrate an application without bringing along technical debt such as old operating systems, while maintaining all of the benefits a VMware-based environment provides.

The following assumptions are made with regards to this document:

  1. All connectivity between on-premises and the VMware Cloud on AWS SDDC is in place.
  2. Your application is running successfully on-premises and in the VMware Cloud on AWS SDDC.
  3. Security groups have been created to allow access as needed between all of the services being used.

Our first step is to get the IP address(es) of the target virtual machines, both on-premises and in the SDDC. Once we have this information, you need to log into the AWS console and go to the EC2 service. On the left-hand side, scroll down to the Load Balancing section and click Target Groups. Click Create target group button on the right.

Specify group details

Here you will select IP Addresses, give the group a name, such as demo-onprem, choose the protocol and port to be used, the VPC where your load balancer will reside, the protocol version, any health checks, and any tags you need. I’ll be using the VPC where my SDDC is deployed.

Register Targets

Here we choose Other private IP addresses and input the IP address of our on-prem virtual machine. Click the Include as pending below button and repeat for any other IP addresses you may have. Once you have added all of the IPs for the on-prem virtual machines, click the Create target group button. Repeat the same steps to create a target group for any of the IPs you will use in your VMware Cloud on AWS SDDC virtual machines (I named mine demo-vmconaws). Make sure you create them in the same VPC.

Register targets screen

Once you have created your target groups, make sure that they are reporting as healthy. You can do that by selecting the checkbox next to a target group.

Target group health view

Now that we have our on-premises and SDDC target groups created, it’s time to create our load balancer. For my example I will be using an Application Load Balancer, because my example runs over HTTP/HTTPS. If you need to run over other ports, you will need to use a Network Load Balancer, which allows other port and protocol options beyond what the ALB provides. To create your load balancer, on the left in the same section, click Load Balancers, then click Create load balancer on the right. Next, click the Create button for the type of load balancer you want to create.

Basic Configuration

In the Basic configuration section, we provide a name for the load balancer, choose whether it will internet-facing or internal (I chose internal for this demo), and choose IPv4 or Dualstack for you IP address type.

Load balancer basic configuration

Network Mapping

In the Network Mapping section, we choose the VPC and the subnets that will be available to the load balancer. Make sure to choose the same VPC that you create the target groups in.

Load balancer network mapping

Listeners and routing

In this section, you will create a listener for the load balancer on the protocol and port you used for the target groups that were created previously. For the default action, set it the demo-onprem target group that was created previously (or you can create one directly from the link).

Load balancer listeners

In the remaining sections you can add an AWS Global Accelerator or add some tagging. Make sure to review the summary section and then click Create load balancer when complete.

Load balancer extras

Once your load balancer is created, click the name link and under the Listeners and rules tab, click the Protocol:Port link.

Load balancer protocol port

In the Listener rulers section, check the box next to the rule we created and choose Edit rule from the Actions drop down.

Load balancer listener rule

In the Listener details, click the Add target group button and select the demo-vmconaws target group we created. Make sure to set the weight to 0 or else it will route traffic to both target groups.

Load balancer add target group

If you want to do a partial migration to test and move a portion of the traffic to one target group or the other, you can do that with adjusting the weights.

load balancer options

Now that you have both target groups setup, you can verify functionality by using the load balancer link and adjusting the weights. With the demo-onprem target group receiving 100% weight, you should see the following when launching the load balancer url:

web onprem

Now adjust the weight for demo-onprem to 0 and demo-vmconaws to 1 and refresh the page.

Load balacner weight vmc web vmconaws

This is just another way we can leverage the power of AWS native services combined with VMware Cloud on AWS to help accelerate our customers’ journey to the cloud.