...

/

Working with CloudFormation Templates

Working with CloudFormation Templates

Get a working knowledge of AWS CloudFormation templates.

Before provisioning and configuring any AWS cloud resources, we must first understand and learn to work with CloudFormation templates. A CloudFomration template contains all the key instructions to deploy an AWS infrastructure’s resources using CloudFormation.

In this lesson, we’ll explore the basic aspects of a CloudFormation template and how to create a new one or reuse and adapt an existing one according to our needs.

Anatomy of a CloudFormation template

CloudFormation uses templates to define the AWS resources that we want to create and configure. Templates are written in a declarative language, with supported JSON and YAML. All resources that we want to provision and the order in which we want to provision them are essentially declared in a CloudFormation template.

Templates can be version-controlled, just like any other code, making it easier to roll back any changes in case of deployment failure without compromising the entire infrastructure.

Press + to interact

The CloudFormation template has several aspects, and each supported AWS resource has its own syntax and parameters that we need to follow. To keep things simple, we’ll only explore the basic anatomy of a CloudFormation template, which is enough to start working with templates for the commonly used general CloudFormation stacks. The following illustration provides a breakdown of the different sections in a CloudFormation ...