AWS CloudFormation
AWS CloudFormation allows system administrators and developers to easily create and manage AWS resources and provision them in a predictable and orderly fashion.
CloudFormation includesTemplateis, an architectural diagram
A JSON- or YAML-formatted, text-based file that lists all AWS resources required to run your application
Stackis the final result of that diagram, and is actually provisioned
This is the collection of AWS resources that are created as a single unit when CloudFormation creates a template.
CloudFormation template is used to set up resources consistently across multiple regions.
You can update, delete, or modify resources in a controlled and predictable manner. This is similar to applying version control to the infrastructure, which is done for software code.
AWS CloudFormation template consists of the following elements:-List AWS resources and configuration values
Optional version number of the template file format
A list of optional template parameters (input values provided at stack creation time).
Optional output values, such as public IP addresses, can be provided using the Fn.GetAtt function
An optional list of data table used to lookup static configuration value for e.g. AMI names per AAZ
CloudFormation supports Chef & Puppet Integration for deploying and configuring right down to the application layer
CloudFormation offers a set of application bootstrapping scripts that allow you to install files, packages, and services on EC2 instances. All you have to do is describe them in the CloudFormation template
Automatic rollback on errors is enabled by default. This will cause all AWS resources CloudFormation has successfully created for a stack to be deleted, up to the point that an error occurred.
If automatic rollback is used, charges will still be applied for the resources during their initial use
CloudFormation has a WaitCondition resource which acts as a barrier and blocks the creation of additional resources until a completion signal from an external source is received, e.g. Application or management system
CloudFormation allows you to define deletion policies for resources in the template. CloudFormation allows you to retain resources or create snapshots before deletion. This is useful for preserving S3 buckets after the stack is deleted.
AWS CloudFormation Concepts
AWS CloudFormation lets you use templates and stacks
Templates
These blueprints can be used to build AWS resources.
It is a JSON- or YAML-formatted text file that can be saved with any extension such as.json or.yaml or.template or.txt.
Additional capabilities to create complex resources and reuse them in multiple contexts, e.g. Use input parameters to create generic and reusable templates
Name used to identify a resource within the template. However, when CloudFormation creates a resource, it generates an physical name based on the combination logical, stack name, and unique IDStacks
Stacks can manage related resources as a single unit.
You can create, update, and delete resources by creating, updating and deleting stacks.
The AWS CloudFormation template for a stack defines all the resources within a stack
Change Sets
CloudFormation’s proposed changes to a stack are summarized in Change Sets.
Before implementing changes, change sets are used to assess the impact of any changes on running resources, particularly critical resources.
CloudFormation only makes changes to the stack when the change set is executed. This allows you to decide whether to proceed or explore other changes by creating anoths.
