Add an endpoint to the endpoint group

The new challenge is to make sure your web application uses at least two ALBs, different reasons can explain this requirement:

  • compliance,
  • blue/green deployments,
  • A/B testing,
  • failover in case for example something happens to the Lambda function,
  • handle increased traffic,
  • etc.

Let’s use the same CloudFormation template to create a second ALB and add it to our endpoint group.

  1. Launch the CloudFormation you used in the Workshop Initialization in the region you previously created the stack in. I choose AGAWorkshop2 as the stack name, wait for the stack to be completely created (it takes about 3 minutes).
  2. Open the Amazon Global Accelerator console.
  3. Choose your accelerator (AGAWorkshop by default).
  4. Under Listeners, click on your listener.
  5. Under Endpoint groups, click on your endpoint group.
  6. On the endpoint group page, click on Add endpoint.
  7. As for the previous lab, add the new endpoint to the endpoint group
    • Endpoint Type: Application Load Balancer
    • Endpoint: [Choose the new ALB created via CloudFormation] - The list will auto-populate for you
    • Weight: 0 - we will see what endpoint weights are later in this lab
    • Keep Preserve client IP address checked
  8. Click on Save

x

Verify that the new endpoint does not serve traffic

  1. Via cURL
$ for i in {1..100}; do curl http://aebd116200e8c28ad.awsglobalaccelerator.com/ --silent >> output.txt; done; cat output.txt | sort | uniq -c ; rm output.txt;
100 Processed in US-WEST-2 by AGAWorkshop-Function-P5UKYRRL0N05
  1. Via a browser (you will get the same response if you refresh several times) x

  2. If you are at an AWS Event, use the web page the instructor shared with you x

A weight is a value that determines the proportion of traffic that Global Accelerator directs to an endpoint. Global Accelerator calculates the sum of the weights for the endpoints in an endpoint group, and then directs traffic to the endpoints based on the ratio of each endpoint’s weight to the total.

To make sure your new load balancer is well configured and can handle traffic, send only a portion of the traffic to it, lets change it endpoint weight from 0 to 10, keep the endpoint weight of the initial load balancer to 128. By doing so, the new endpoint will serve 10 / (10 + 128) * 100 % of the traffic, this is around 7% of the traffic.

Weighted routing lets you choose how much traffic is routed to a resource in an endpoint group. This can be useful in several ways, including load balancing and testing new versions of an application. See more details here.

  1. Open the Amazon Global Accelerator console.
  2. Choose your accelerator (AGAWorkshop by default).
  3. Under Listeners, click on your listener.
  4. Under Endpoint groups, click on your endpoint group.
  5. On the endpoint group page, select the endpoint (do not click on) that has 0 as weight and click on Edit.
  6. Change the weight from 0 to 10
  7. Click on Save changes

Verify that the new endpoint serves some traffic

  1. Via cURL
$ for i in {1..100}; do curl http://aebd116200e8c28ad.awsglobalaccelerator.com/ --silent >> output.txt; done; cat output.txt | sort | uniq -c ; rm output.txt;
  92 Processed in US-WEST-2 by AGAWorkshop-Function-P5UKYRRL0N05
   8 Processed in US-WEST-2 by AGAWorkshop2-Function-5N9U2S8PPDFP
  1. Via a browser (you will get the new ALB from time to time if you refresh the browser) x

  2. If you are at an AWS Event, use the web page the instructor shared with you x

Play with endpoint weights to see how AWS Global Accelerator routes requests to endpoints in an endpoint group.

Since everything seems to be working as expected with the new endpoint, let’s increase it endpoint weight from 10 to 128. The two endpoints (ALBs) should serve approximately the same amount of traffic. x

Verify that the two endpoints serve around the same amount of traffic

  1. Via cURL
$ for i in {1..100}; do curl http://aebd116200e8c28ad.awsglobalaccelerator.com/ --silent >> output.txt; done; cat output.txt | sort | uniq -c ; rm output.txt;
  48 Processed in US-WEST-2 by AGAWorkshop-Function-P5UKYRRL0N05
  52 Processed in US-WEST-2 by AGAWorkshop2-Function-5N9U2S8PPDFP
  1. Via a browser (refresh the page to see what happens) x

  2. If you are at an AWS Event, use the web page the instructor shared with you x

CHECKPOINT: You just added a new endpoint to your endpoint group. This could help you to easily implement blue/green deployments, A/B testing, failover in case for example something happens a Lambda function, handle increased traffic, etc. Ready for the next challenge?


CHALLENGE 3: The business is growing, you now have thousands of users in different regions around the world and would like to further improve performance by serving them from load balancers closer to them. You also received a new compliance requirement: the application must be deployed in at least two AWS regions. How would you do this - Ready? Move to the next lab!