Workshop initialization

Your web application consists on a Lambda function behind an Application Load Balancer deployed in a single AWS Region. In this lab, you’ll use a CloudFormation template to launch the web application. All the resources created during this workshop will be deleted in the cleanup lab.

0. Note for AWS hosted events

This workshop contains self-guided labs, you can take it by yourself without an instructor. If the workshop is part of an AWS hosted event (such as re:Invent, Kubecon, Immersion Day, etc.) the instructor can follow the notes here to create 4 clients (EC2 instances) in different regions that will be used by the workshop participants to test their accelerator settings.

1. Deploy the CloudFormation Stack

Launch the CloudFormation stack in an AWS Region of your choice, note down the region - I choose US-WEST-2 (Oregon) region. The template will create the following resources:

  • a VPC with an Internet Gateway and two subnets
  • a Lambda function
  • an Application Load Balancer with the Lambda function as target
  • an IAM role the Lambda service will assume
  • a permission to the Application Load Balancer to invoke the Lambda function
Region Launch Template
Oregon (us-west-2) Launch stack in Oregon
Dublin (eu-west-1) Launch stack in Dublin
Tokyo (ap-northeast-1) Launch stack in Tokyo
Sydney (ap-southeast-2) Launch stack in Sydney
Canada (ca-central-1) Launch stack in Canada
Mumbai (ap-south-1) Launch stack in Mumbai

The link will automatically bring you to the CloudFormation dashboard and start the stack creation process in the specified region. The default stack name AGAWorkshop, proceed through the wizard to launch the stack. Leave all options at their default values, but make sure to check the box to allow CloudFormation to create IAM roles on your behalf:

x

x

After you click on Create stack, you will have the following window, it takes about 3 minutes for the stack to be created.

x

x

The best way to get started with AWS CloudFormation is to work through the Getting Started Guide, which is included in our technical documentation. Within a few minutes, you will be able to deploy one of the sample templates and start creating your own infrastructure configurations.

2. Test your web application

Get the URL/DNS of your web application

There are different ways to get the Application Load Balancer URL/DNS:

  1. Since you are in CloudFormation console, select the Stack (AGAWorkshop), and then the Outputs tab, you should see the URL
  2. Use the EC2 Console: EC2 > Load Balancing > Load Balancers > AGAWo-Appli- * > DNS Name
  3. You can also use the CLI:
$ aws cloudformation describe-stacks --stack-name AGAWorkshop --query "Stacks[0].Outputs[?OutputKey=='URL'].OutputValue" --output text --region us-west-2
http://AGAWo-Appli-9CXFU1XOCSJ6-977194569.us-west-2.elb.amazonaws.com

Access the web application

  1. Via cURL
$ curl http://AGAWo-Appli-9CXFU1XOCSJ6-977194569.us-west-2.elb.amazonaws.com
Processed in US-WEST-2 by AGAWorkshop-Function-P5UKYRRL0N05
  1. Via a browser x

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

CHECKPOINT: You have a working web application deployed in a single AWS Region: a Lambda function behind an Application Load Balancer.


CHALLENGE 1: You would like to improve the web application performance; you received complains from some users, quick TCP Traceroutes show multiple hops and packet drops between their locations and the ALB endpoint. Luckily, you recently attended an event where AWS Global Accelerator was presented, you decide to implement it to improve your web application performance and availability. Ready? Move to the next lab!