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.
Duration: 30 minutes
AWS Region: US East (N. Virginia) us-east-1
Introduction
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.
CloudFormation is a service provided by AWS for designing our own infrastructure using code i.e infrastructure as code.
Currently, CloudFormation supports two languages JSON and YAML. You can write your code with one of the languages.
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.
A fascinating feature of cloudFormation is that it saves more time in building infrastructure and helps in focusing on the development.
It is also possible to replicate our infrastructure in a short amount of time.
It eliminates human error and works according to the code you have written. It consists of two main components, Stack and Templates.
It consists of various sections like
AWS Template Format Version
Description
Metadata
Parameters
Mappings
Conditions
Resources (Required Field)
Outputs
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.
The resources section plays an important role in the template creation.
For example, to create an EC2 instance, a template shall consist of various parameters such as key name, image id, instance type.
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.
A stack consists of a collection of resources.
In other words, the stack consists of one or more templates.
The advantage of the stack is that it is easy to create, delete or update the collection of resources.
The advanced stacks have a nested stack which holds a collection of stacks.
Task Details
Log into the AWS Management Console.
Exploring templates in an S3 bucket.
Create CloudFormation Stack.
Testing
Validation of the lab.