Introduction to Amazon CloudFormation

Lab Details

  1. This lab walks you through AWS CloudFormation features. In this lab, we will demonstrate the use of AWS CloudFormation Stack through creating a simple LAMP Server.

  2. Duration: 30 minutes

  3. AWS Region: US East (N. Virginia) us-east-1



LAMP Server

LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is an acronym denoting one of the most common solution stacks for many of the web's most popular applications. However, LAMP now refers to a generic software stack model and its components are largely interchangeable.

AWS CloudFormation

  1. CloudFormation is a service provided by AWS for designing our own infrastructure using code i.e infrastructure as code.

  2. Currently, CloudFormation supports two languages JSON and YAML. You can write your code with one of the languages.

  3. CloudFormation comes with great features being able to update your infrastructure whenever you want and also having the ability to delete the stack in case you don’t need it.

  4. A fascinating feature of cloudFormation is that it saves more time in building infrastructure and helps in focusing on the development.

  5. It is also possible to replicate our infrastructure in a short amount of time.

  6. It eliminates human error and works according to the code you have written. It consists of two main components, Stack and Templates.

CloudFormation Template

  1. It consists of various sections like 

  • AWS Template Format Version

  • Description

  • Metadata

  • Parameters

  • Mappings

  • Conditions

  • Resources (Required Field)

  • Outputs

  1. It is not mandatory that the template requires all the above-mentioned sections. By using only the Resources section, we will be able to create a template.    

  2. The resources section plays an important role in the template creation.

  3. For example, to create an EC2 instance, a template shall consist of various parameters such as key name, image id, instance type.

  4. It is also possible to create two resources in the same template and refer to one from another i.e. attaching an elastic IP with an EC2 instance.

CloudFormation Stack

  1. A stack consists of a collection of resources. 

  2. In other words, the stack consists of one or more templates.

  3. The advantage of the stack is that it is easy to create, delete or update the collection of resources.

  4. The advanced stacks have a nested stack which holds a collection of stacks.


Architecture Diagram

Task Details

  1. Log into the AWS Management Console.

  2. Exploring templates in an S3 bucket.

  3. Create CloudFormation Stack.

  4. Testing

  5. Validation of the lab.