Deploying Multi-tier Infrastructure & Updating using CloudFormation

This hands-on lab will guide you through the steps to improve reliability of a service by using automation to deploy a reliable cloud infrastructure. When this lab is completed, you will have deployed two CloudFormation templates. The first will deploy an Amazon Virtual Private Cloud (VPC).

The second will deploy into your VPC, a reliable 3-tier infrastructure using Amazon EC2 distributed across three Availability Zones.

You will then review the features of the deployed infrastructure and learn how they contribute to reliability.

Task 1 :- Lets Start with creating VPC

  • Download the simple_stack.yaml CloudFormation template

The template is written in a format called YAML , which is commonly used for configuration files. The format of the file is important, especially indents and hyphens. CloudFormation templates can also be written in JSON.

Simple VPC

Task 2 :- Deploying an AWS CloudFormation stack to create a simple VPC

Go to the AWS CloudFormation console at and click Create Stack > With new resources


Click Create Stack, then With new resources (standard) Then Click Upload a template file (simple_stack.yaml was downloaded earlier) and then click Choose file.

  • Leave Prepare template setting as-is

Enter the following details:

  • Stack name: The name of this stack. For this lab, use Simple-VPC and match the case.

Quick Tip: change Instance Type :t2.micro as part of free tier on AWS

For Review

  • Review the contents of the page

This will take you to the CloudFormation stack status page, showing the stack creation in progress.

  • Click on the Events tab

Return to the AWS CloudFormation console

  • Click the Resources tab for the CloudFormationLab stack. The listing shows all the resources that were created. In this case just the VPC

Then Click on Stacks

  • Click on the CloudFormationLab stack > Click Update
  • Click Next again, until you arrive at the Review CloudFormationLab screen

The current deployment is now represented by this architecture diagram:

Task 3 :-Edit the CloudFormation template file

Edit the simple_stack.yaml file you downloaded earlier to include an Amazon S3 bucket using below yaml template.

Type: AWS::S3::Bucket
BucketName: !Ref S3BucketName
  • Under the Resources section add the snippet you copied

Task 4 :- Update the CloudFormation stack — specify updated template

  1. Go to AWS CloudFormation console >Click on Stacks > Click on the stack

At the bottom of the page, select I acknowledge that AWS CloudFormation might create IAM resources with custom names

  1. Click Create stack
  • Note your new S3 bucket is listed among the resources deployed

Task 5 :- Add the EC2 instance resource to your CloudFormation template and deploy it

  1. Edit the CloudFormation Template, adding a new resource for an EC2 instance

2. Use this documentation page for assistance: AWS::EC2::Instance

  • Use the YAML format

- Key: Name
Value: Simple Server


  • When referring to other resources in the same template, use !Ref. See the BucketName example you already implemented
- !Ref PublicSecurityGroup

3. Once you have edited the template, update the stack deployment with your revised template file.

  • On the Parameters screen of the CloudFormation update switch EC2SecurityEnabledParam to true

4. Go to the EC2 console to see the Simple Server that was created. Explore the properties of this EC2 instance.

The final deployment is now represented by this architecture diagram:

Task 6 :- Remove AWS CloudFormation provisioned resources

You will now delete the CloudFormationLab stack.

How to delete an AWS CloudFormation stack

  1. Go to the AWS CloudFormation console:
  • Click the stack name

Feel free to customize according to your own way & experiment it using different services and resources.

In the next post ill show you how deploy similar resources but in faster more efficient way using Terraform (infra-as-a-code) if you are interested.

Please click the clap 👏 button below to encourage & support me to keep posting more content.

Terraform: Associate | AWS:SSA| RHCSA| VCP:DCV|ITIL Certified

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