You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Every CloudFormation template follows a well-defined structure. Understanding the anatomy of a template is essential for writing, reading, and debugging infrastructure definitions. In this lesson we will examine each section of a template, what it does, and when to use it.
A CloudFormation YAML template can contain the following top-level sections:
AWSTemplateFormatVersion: '2010-09-09'
Description: A description of what this template does
Metadata:
# Optional information about the template
Parameters:
# Input values supplied at stack creation time
Mappings:
# Static key-value lookup tables
Conditions:
# Logic to control whether resources are created
Resources:
# The AWS resources to create (REQUIRED)
Outputs:
# Values to return after the stack is created
Only the Resources section is required. All other sections are optional, but most real-world templates use several of them.
This declares the template format version. The only valid value is '2010-09-09', which has been the version since CloudFormation launched. You should always include it for clarity:
AWSTemplateFormatVersion: '2010-09-09'
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.