3 The CloudFormation Stack Lifecycle

 

This chapter covers:

  • Understanding the CloudFormation Stack lifecycle (create, update, delete) using the example of a static website running on an EC2 instance.
  • Creating a CloudFormation template using features like parameters and conditions to provide flexibility in choice of instance type, AMI and security at the time of creation of the stack.
  • Using User Data, Metadata and cfn:init helper scripts in a CloudFormation template to install and update software and your web site code.
  • Getting started with versioning and change management, so you can update your website content without re-deploying or logging into an instance.

Here we will build on concepts we learned in Chapter 1, and our discussion of the template structure in Chapter 2, by using the example of a static HTML5 website running on an EC2 instance.

We’ll use the main parts of CloudFormation template structure to build a template that provides flexibility in the stack that will be deployed so the engineer executing the create stack command can customize certain parameters to meet the particular needs of the deployment.

Then, we’ll examine how to make updates to the running website and its underlying infrastructure from the Console and/or the command line, always using CloudFormation to manage the changes and deploy them to stacks in production.

3.1       Understanding the Stack Lifecycle

3.1.1   Create

3.1.2   Update

3.1.3   Delete

3.2       Building a Basic Website

3.2.1   Template Version

3.2.2   Description

3.2.3   Parameters

3.2.4    Mappings

3.2.5   Bootstrap: CloudFormation Helper Scripts and User Data

3.2.6   Resources

3.2.7   Properties

3.2.8   Outputs

3.3       Create the Stack to Deploy the Website

3.4       Test the Website Deployment

3.5       Delete the Website

3.6       Summary

sitemap