Summary and Quiz
Get a refresher on what you’ve learned in the CloudFormation chapter, and take a short quiz to validate your knowledge.
We'll cover the following
In this lesson, we’ll summarize what we’ve learned in this section and test our knowledge of the AWS CloudFormation service with a short quiz.
Summary
Here’s a summary of the key takeaways from this section:
AWS CloudFormation service: The AWS CloudFormation manages the AWS cloud infrastructure as code. CloudFormation allows us to provision and manage AWS cloud resources as a collection, also known as a stack.
Benefits of CloudFormation: AWS CloudFormation offers the following benefits:
Automation: We can automate the management of our AWS cloud infrastructure, reducing any manual overhead.
Easier resource management: We can leverage the AWS CloudFormation service to improve the scalability and consistency of our AWS cloud infrastructure.
Reusability across regions: We can reuse CloudFormation templates for deployment in different AWS regions and AZs.
Tracking changes: We can easily track modifications to our cloud infrastructure.
Cost management: We can tag resources in CloudFormation stacks for easier cost tracking.
Cost considerations: While CloudFormation itself is free, users can still incur costs for the AWS resources provisioned through CloudFormation. AWS follows the pay-as-you-go model without upfront commitments.
CloudFormation templates: CloudFormation templates are declarative files, written in either JSON or YAML, specifying AWS resources for CloudFormation to provision with the required configurations.
Creating CloudFormation templates: Templates can be manually written, modified from existing ones, or visually designed using AWS tools like the CloudFormation Designer. Templates can also be generated by importing existing AWS resources into CloudFormation.
Anatomy of CloudFormation templates: A CloudFormation Template includes the following sections:
AWSTemplateFormatVersion
,Description
,Metadata
,Parameters
,Mappings
,Conditions
,Resources
, andOutputs
.Change sets: A change set is a summary of proposed changes to a CloudFormation stack generated when updating or creating a stack. It allows previewing and validating modifications, additions, or removals of AWS resources before implementing them into the stack.
Using change sets: Change sets are generated automatically when updating a stack or creating a new one, providing a preview of changes. They can be viewed, modified, and validated before execution, ensuring the stack is updated as intended.
Drifts in a stack: Drifts are unintended changes made directly to AWS resources outside of CloudFormation, which can cause discrepancies between the stack’s actual state and the proposed state in the template.
Stack policies: These are JSON documents defining permissible actions on CloudFormation stack resources. When updating a stack, they safeguard critical resources from unintended or unauthorized modifications or deletions.
CloudFormation helper scripts: These helper scripts facilitate the initialization and configuration of runtime-based AWS resources like EC2 instances. These helper scripts are as follows:
cfn-init
: We use thecfn-init
helper script to install packages, create files, and configure services based on configuration in the metadata.cfn-signal
: We use thecfn-signal
helper script to signal CloudFormation that the EC2 instance has initialized.cfn-hup
: We use thecfn-hup
helper script to detect metadata changes and execute any required commands accordingly.cfn-get-metadata
: We use thecfn-get-metadata
helper script to retrieve metadata of any requested AWS resources provisioned with CloudFormation.
Test your knowledge
Take a short quiz to validate that knowledge and to make sure you’ve not missed out on anything:
What can not be achieved when dealing with the infrastructure as code?
Deploying infrastructure resources based on code instructions.
Reducing human error and keeping resource configurations consistent across infrastructure.
Easily replicate the same infrastructure in different AWS regions.
Managing stateful services, such as databases, that require persistent data storage.
Congratulations! We’ve successfully gone through the essential concepts of the AWS CloudFormation service and refreshed our knowledge of it.
Get hands-on with 1300+ tech skills courses.