DEPLOY A RELIABLE MULTI-TIER INFRASTRUCTURE USING CLOUDFORMATION

Introduction

This document will guide you through the steps to improve reliability of a service by using automation to deploy a reliable cloud infrastructure. During the process that follows, I have deployed the following;

· Two CloudFormation templates

· The first an AWS Virtual Private Cloud (VPC)

· The second into my VPC, a reliable 3-tier infrastructure using Amazon EC2 distributed across three availability zones.

These skills will help build resilient workloads in alignment with the AWS Well-Architected Framework best practices.

At the end I’ll review the features of the deployed infrastructure and learn how they contribute to reliability from the representation in the following diagram.

DEPLOY VPC USING CLOUDFORMATION

1.1 Log into the AWS Console

* Login to your AWS Console with an IAM identify that has PowerUserAccess or AdministratorAccess permissions.

1.2 Configure your AWS Region

Select the first region for this exercise. Region options are at the upper right of the AWS Management Console, this exercise requires Ohio (us-east-2)

** Exam Tips:

  • AWS offers you the ability to deploy to over 20 regions located across the globe.
  • Each region is fully isolated from the others to isolate any issues and achieve high availability.
  • Each region is comprised of multiple Availability Zones, which are fully isolated partitions of our infrastructure.

1.3 Deploy the VPC Infrastructure

This step will create the VPC and all components using the example CloudFormation template.

  1. Download the latest version of the CloudFormation template
  2. From the AWS Management Console, AWS Services, click CloudFormation

(If you have to select Services at the top-left, you will find CloudFormation under the section Management and Governance.)

3. Once on the AWS CloudFormation page, Click Create Stack.

4. On the Create a Stack page, select Upload a template file and then Choose file.

5. Select the template file you downloaded in step 1 above, after selecting the file and returning to the CloudFormation page, click Next.

6. Enter the following details:

  • Stack name: WebApp1-VPC
  • Parameters: Leave as defaults (not shown)

7. At the bottom of the page, click Next.

8. On the Configure stack options page, we will configure Tags as follows; type in “owner” as the key and enter your actual “email address” as the value. All other option remain as is, for further reading on configuring additional stack options, click here.

9. Click Next at the bottom of the page.

10. Upon review of your configuration, check the box for acknowledgement that AWS CloudFormation might create IAM resources with custom names at the bottom of the page then click Create stack.

Note: It will take a few minute for the VPC stack to create, watch the status as it changes from CREATE_IN_PROGRESS to CREATE_COMPLETE.

DEPLOY WEB APPLICATION AND INFRASTRUCTURE USING CLOUDFORMATION

1.4 Deploy Application

1. Let’s download another CloudFormation template here to create our next stack.

2. From the CloudFormation page, click Create stack.

* For reference, repeat the previous steps of 1.3–3–1.3–5 (Choose file will be as displayed in the diagram below).

3. Click Next.

4. For the Stack name, type in CloudFormationLab.

  • Parameters: Leave as defaults (not shown)

5. At the bottom of the page, click Next.

6. On the Configure stack options page, we will configure Tags as follows; type in “owner” as the key and enter your actual “email address” as the value. All other options remain as is, for further reading on configuring additional stack options, click here.

7. At the bottom of the page, click Next.

8. 3. Upon review of your configuration, check the box for acknowledgement that AWS CloudFormation might create IAM resources with custom names at the bottom of the page. Click Create stack.

Note: It will take a few minute for the VPC stack to create, watch the status as it changes from CREATE_IN_PROGRESS to CREATE_COMPLETE.

  • 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.

Once the stack completes its creation process, move on to explore the web application.

EXPLORE THE WEB APPLICATION

  1. From CloudFormation page, select Stacks and click CloudFormationLab stack, then the Output tab.

2. In the Outputs section of the stack, you can copy and paste the URL to a browser or simply click it to display to results of the Web Application.

1.5 Review of Features and Explanation of Deployed Infrastructure:

The Website shown above simulates a recommendation engine making personalized suggestions for classic television shows.

  • The website utilizes an Amazon DynamoDB table that contains the name of users and shows to recommend.
  • On every request of the website for each user, a shows recommendation that is statically mapped to that user is selected using the RecommendationService.
  • Metadata showing which “instance_id” and “availability_zone” enables you to see which EC2 server and Availability Zone was used for each request.

The Website and Metadata shown above, does not show;

  • Elastic Load Balancing (ELB). An application Load Balancer that receives each request and distributes it among the available EC2 server instances across Availability Zones. The requests are stateless, and therefore can be routed to any of the three healthy EC2 instances.
  • The EC2 instances are in an Amazon EC2 Auto Scaling Group. This Auto Scaling Group was configured to maintain three instances, therefore if one instance is detected as unhealthy it will be replaced to maintain three healthy instances.

At the beginning of this project, I showed the following diagram, the five bullet points discussed above explains how the two template files and CloudFormation stacks were used to create this cloud infrastructure for reliability.

Note: AWS Auto Scaling can also be configured to scale up/down dynamically in response to workload conditions such as CPU utilization or request count.

This project was built using the Well-Architected for Reliability Best Practices:

1. Use Highly available network connectivity for your workload public endpoints.

2. Implement loosely coupled dependencies.

3. Deploy the workload to multiple locations.

4. Automate healing on all layers.

EXPLORE THE CLOUDFORMATION TEMPLATE

To further explore the CloudFormation template used to deploy either stack that was created;

· Click on the CloudFormation stack that you deployed.

· Click on the Template tab

You will notice several sections; click each link for additional learning on the topic.

· The Parameters section is used to prompt for inputs that can be used elsewhere in the template. The template is asking for several inputs, but also provides default values for each one.

· The Conditions section is where you can setup if/then-like control of what happens during template deployment. It defines the circumstances under which entities are created or configured.

· The Resources section is the “heart” of the template. It is where you define the infrastructure to be deployed.

· The Outputs section is used to display selective information about resources in the stack.

· The Metadata section here is used to group and order how the CloudFormation parameters are displayed when you deploy the template using the AWS Console.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store