2 AWS CloudFormation

 

This chapter covers:

  • Introducing AWS CloudFormation
  • Identifying the major sections of a CloudFormation template, and how they are used.
  • Understanding how to build and manage templates using tools provided by AWS and others, including Console, CloudFormation Designer, and AWS Command Line.
  • Creating, updating and deleting CloudFormation stacks using the Console the Command Line.

2.1       Introduction

AWS CloudFormation is the AWS-specific implementation of Infrastructure as Code (IaC), as we defined it in chapter 1. CloudFormation automates the deployment of resources on AWS.

With CloudFormation, you specify the details of the infrastructure you wish to deploy by creating JSON or YAML files, which are called templates. The templates are used to define all aspects of your environment, including computing, database, storage and networking, as well as Identity and Access Management (IAM) and Security, and many other AWS products and services.

When you build these templates, you’ll use a CloudFormation-specific structure (often called template anatomy), which we will describe in detail in this chapter. We’ll provide the opportunity for you to try out a variety of templates in action as we work through examples in this book.

2.2       Template Structure

2.2.1   Getting Started

2.2.2   Basic Template Rules

2.2.3   AWSTemplateFormatVersion

2.2.4   Description

2.2.5   Metadata

2.2.6   Parameters

2.2.7   Pseudo Parameters

2.2.8   Mappings

2.2.9   Intrinsic Functions

2.2.10    Resources

2.2.11    Outputs

2.3       Using CloudFormation Designer

2.4       Console vs. Command Line (AWS CLI)

2.4.1   HelloBucket

2.4.2   Did the Stack Really Deploy?

2.4.3   Delete Your HelloBucket from the Console

2.5       Create a Stack using the Command Line

2.5.1   Install the AWS Command Line

2.5.2   Deploy an EC2 Instance

2.5.3   Find Your EC2 Instance

2.5.4   Let’s Give Our Instance a Name and a Tag

2.5.5   Use the AWS CLI to determine the stack was created successfully

2.5.6   Delete the Stack from the Command Line

2.6       Summary

sitemap