- use templates to operate AWS resources
- create resources
- update resources
- delete resources
Template example (note that in practice, two spaces should be used as indentation instead of 4 spaces or tabs)
AWSTemplateFormationVersion: "version date"
Description:
...
# Control order, grouping of resources in UI
# Also have other configuration purposes
Metadata:
...
# Prompt for user inputs, can configure valid values as well
Parameters:
...
# Configure look-up tables
Mappings:
...
# Define conditions that can be used elsewhere
# to determine whether a resource will be
# created
Conditions:
...
Transforms:
...
# List of resources being created
Resources:
Instance:
Type: 'AWS::EC2::Instance'
Properties:
...
Metadata:
...
...
# Present output like instance ID or IP address
Outputs:
...
- Using a template creates a stack which maps a logical resource in template to a physical resource (e.g. actual EC2 instance). If the template is updated, the stack can also be updated accordingly.
- Template file can be uploaded to AWS console, which creates a S3 bucket for that file with a name starting with
cf-