Deploy the Infrastructure and Application
You will create a multi-tier architecture using AWS and run a simple service on it. The service is a web server running on Amazon EC2. It has an Elastic Load Balancer reverse-proxy in front of it, and has a dependency on Amazon DynamoDB.
Note: The concepts covered by this lab apply whether your service dependency is an AWS resource like Amazon DynamoDB, or an external service called via API. The DynamoDB dependency here acts as a mock for an external service called RecommendationService. The getRecommendation API on this service is a dependency for the web service used in this lab. getRecommendation is actually a get_item
call to a DynamoDB table.

1.1 Log into the AWS console
If you are attending an in-person workshop and were provided with an AWS account by the instructor:
Click here for instructions to access your assigned AWS account:
Go to https://dashboard.eventengine.run/login
Enter the 16 character hashcode you were provided and click “Proceed”

Sign-in using either an Amazon.com retail account or a One-Time Password (OTP) that will be emailed to you.

[optional] assign a name to your account (this is referred to as “Team name”)
- click “Set Team Name”
- Enter a name and click “Set Team Name”
Click “AWS Console”

Get and store your AWS credentials
Access the AWS console
- Click “Open AWS Console”.
- The AWS Console will open and you can continue the lab.
If you are using your own AWS account:
Click here for instructions to use your own AWS account:
- Sign in to the AWS Management Console as an IAM user who has PowerUserAccess or AdministratorAccess permissions, to ensure successful execution of this lab.
You will deploy the service infrastructure including simple service code and some sample data.
- It is recommended that you use the Ohio region. This region is also known as us-east-2, which you will see referenced throughout this lab.

- If you choose to use a different region, you will need to ensure future steps are consistent with your region choice.
1.2.1 Deploy the VPC infrastructure
- If you are comfortable deploying a CloudFormation stack, then use the Express Steps
- If you require detailed guidance in how to deploy a CloudFormation stack, then use the Guided Steps
Choose either the Express Steps or Guided Steps
Express Steps (Deploy the VPC infrastructure)
- Download the vpc-alb-app-db.yaml CloudFormation template
- Make sure you are in AWS region: us-east-2 (Ohio)
- Deploy the CloudFormation template
- Name the stack
WebApp1-VPC
(case sensitive) - Leave all CloudFormation Parameters at their default values
- When the stack status is CREATE_COMPLETE, you can continue to the next step
Guided Steps (Deploy the VPC infrastructure)
Click here for detailed instructions to deploy the VPC:
This step will create the VPC and all components using the example CloudFormation template.
- Download the latest version of the CloudFormation template here: vpc-alb-app-db.yaml
- Sign in to the AWS Management Console, select your preferred region, and open the CloudFormation console at https://console.aws.amazon.com/cloudformation/.
- Click Create Stack, then With new resources (standard).

- Click Upload a template file and then click Choose file.

- Choose the CloudFormation template you downloaded in step 1, return to the CloudFormation console page and click Next.
- Enter the following details:
- Stack name: The name of this stack. For this lab, use WebApp1-VPC and match the case.
- Parameters: Parameters may be left as defaults, you can find out more in the description for each.

- At the bottom of the page click Next.
- In this lab, we use tags, which are key-value pairs, that can help you identify your stacks. Enter Owner in the left column which is the key, and your email address in the right column which is the value. We will not use additional permissions or advanced options so click Next. For more information, see Setting AWS CloudFormation Stack Options.
- Review the information for the stack. When you’re satisfied with the configuration, at the bottom of the page check I acknowledge that AWS CloudFormation might create IAM resources with custom names then click Create stack.

After a few minutes the final stack status should change from CREATE_IN_PROGRESS to CREATE_COMPLETE. You can click the refresh button to check on the current status.
You have now created the VPC stack (well actually CloudFormation did it for you).
When the stack status is CREATE_COMPLETE, you can continue to the next step
1.2.2 Deploy the web app infrastructure and service
Wait until the VPC CloudFormation stack status is CREATE_COMPLETE, then continue. This will take about four minutes.
Choose either the Express Steps or Guided Steps
Express Steps (Deploy the EC2s and Static WebApp infrastructure)
- Download the staticwebapp.yaml CloudFormation template
- Make sure you are in AWS region: us-east-2 (Ohio)
- Deploy the CloudFormation template
- Name the stack
HealthCheckLab
(case sensitive) - Leave all CloudFormation Parameters at their default values
- When the stack status is CREATE_COMPLETE, you can continue to the next step
Guided Steps (Deploy the EC2s and Static WebApp infrastructure)
Click here for detailed instructions to deploy the WebApp:
Download the latest version of the CloudFormation template here: staticwebapp.yaml
Go to the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation and click Create Stack > With new resources

Leave Prepare template setting as-is
- For Template source select Upload a template file
- Click Choose file and supply the CloudFormation template you downloaded: staticwebapp.yaml

Click Next
For Stack name use HealthCheckLab
Parameters
For Configure stack options we recommend configuring tags, which are key-value pairs, that can help you identify your stacks and the resources they create. For example, enter Owner in the left column which is the key, and your email address in the right column which is the value. We will not use additional permissions or advanced options so click Next. For more information, see Setting AWS CloudFormation Stack Options.
For Review
- Review the contents of the page
- At the bottom of the page, select I acknowledge that AWS CloudFormation might create IAM resources with custom names
- Click Create stack

This will take you to the CloudFormation stack status page, showing the stack creation in progress.
- Click on the Events tab
- Scroll through the listing. It shows the activities performed by CloudFormation (newest events at top), such as starting to create a resource and then completing the resource creation.
- Any errors encountered during the creation of the stack will be listed in this tab.

When it shows status CREATE_COMPLETE, then you are finished with this step.
1.3 View the website for web service
Go to the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.
- Wait until HealthCheckLab stack status is CREATE_COMPLETE before proceeding. This should take about four minutes
- Click on the HealthCheckLab stack
- Click on the Outputs tab
- For the Key WebsiteURL copy the value. This is the URL of your test web service
- Hint: it will start with
http://healt-alb
and end in <aws region>.elb.amazonaws.com
Click the URL and it will bring up the website:

The website simulates a recommendation engine making personalized suggestions for classic television shows. You should note the following features:
- Area A shows the personalized recommendation
- It shows first name of the user and the show that was recommended
- The workshop simulation is simple. On every request it chooses a user at random, and shows a recommendation statically mapped to that user. The user names, television show names, and this mapping are in a DynamoDB table, which is simulating the RecommendationService
- Area B shows metadata which is useful to you during the lab
- The instance_id and availability_zone enable you to see which EC2 server and Availability Zone were used for each request
- There is one EC2 instance deployed per Availability Zone
- Refresh the website several times, note that the EC2 instance and Availability Zone change from among the three available
- This is Elastic Load Balancing (ELB) distributing these stateless requests among the available EC2 server instances across Availability Zones
Well-Architected for Reliability: Best practices |
---|
Use highly available network connectivity for your workload public endpoints: Elastic Load Balancing provides load balancing across Availability Zones, performs Layer 4 (TCP) or Layer 7 (http/https) routing, integrates with AWS WAF, and integrates with AWS Auto Scaling to help create a self-healing infrastructure and absorb increases in traffic while releasing resources when traffic decreases. |
Implement loosely coupled dependencies: Dependencies such as queuing systems, streaming systems, workflows, and load balancers are loosely coupled. Loose coupling helps isolate behavior of a component from other components that depend on it, increasing resiliency and agility. |
Deploy the workload to multiple locations: Distribute workload data and resources across multiple Availability Zones or, where necessary, across AWS Regions. These locations can be as diverse as required. |