Components of AWS CloudFormation


Amazon CloudWatch
Anomaly Detection
PREVIEW14m 35s
AWS Logging
VPC Flow Logs
Components of AWS CloudFormation
1h 11m

This course provides detail on the AWS Management & Governance services relevant to the Developer - Associate exam.

Want more? Try a lab playground or do a Lab Challenge!

Learning Objectives

  • Get a high-level understanding of Amazon CloudWatch
  • Learn about the features and use cases of the service
  • Create your own CloudWatch dashboard to monitor the items that are important to you
  • Understand how CloudWatch dashboards can be shared across accounts
  • Understand the cost structure of CloudWatch dashboards and the limitations of the service
  • Review how monitored metrics go into an ALARM state
  • Learn about the challenges of creating CloudWatch Alarms and the benefits of using machine learning in alarm management
  • Know how to create a CloudWatch Alarm using Anomaly Detection
  • Learn what types of metrics are suitable for use with Anomaly Detection
  • Create your own CloudWatch log subscription
  • Explain what AWS CloudFormation is and what it’s used for
  • Determine the benefits of AWS CloudFormation
  • Understand what each of the core components are and what they are used for
  • Create a CloudFormation Stack using an existing AWS template
  • Learn what VPC flow logs are and what they are used for

Hello and welcome to this short lecture where I shall be looking at the core components that help to build the service. This will allow you to see how these are related helping you to start building your infrastructure's code.

So in this lecture, I shall be covering the following AWS CloudFormation components, stacks, templates, StackSets, and Designer. Let's start with stacks. 

So what is a stack? A CloudFormation stack is a set of AWS resources that you can provision, update, or delete all at once. For example, a stack could be an amalgamation of the resources required to host a web environment using EC2 instances, RDS databases, and load balancing, et cetera. The stack itself and all the resources associated with the stack are classed as a single unit, and the resources within the stack are identified by associating a CloudFormation template. Each stack has to have a template linked detailing the resource details, so what is a template? 

As I mentioned in the previous lecture templates are comprised of JSON or YAML files, and are text files that describe your environment and resources to build within your account. When constructing these files, you can describe exactly how you want your resources to be configured. For example, the following template snippet dictates the following parameters for an EC2 instance. The blue text shows the AMI ID for the instance. The orange text shows the instance type to be provisioned. The green text shows the key name to be used. And the red text shows the block device mappings, that being an EBS volume and its properties. The completed template will then be used by a stack, to allow CloudFormation to deploy the stack based off the configuration of the template. 

StackSets. A StackSet is essentially the same as a stack which I covered previously. However, StackSets allows you to create, update, or delete your stacks across a number of AWS accounts in different regions with a single template. This allows you to deploy replicated environments across all of your accounts with ease and simplicity where one of your AWS accounts acts as the administrator to control the distribution of stacks. In addition to using stacks, StackSets also use a component known as a stack instance. Now stack instances are simply references to another stack in a different AWS account in a particular region and they belong to a single StackSet. When creating a StackSet you must select a CloudFormation template in addition to the regions in the AWS accounts that you specify. This enables you to deploy the same resources with the same configurations to all targets defined within the StackSet. When you update your StackSet the change replicates to all targets. It's not possible to define changes just for one stack within the set, it acts as a single unit to ensure conformity and consistency throughout your environment across all your accounts. It is possible to delete stacks from within the StackSet without deleting the other stacks. You need to specify the target account and the region in which you want to delete the stack. If you want to delete the stack set itself then you must first delete all stack instances.

Designer. The Designer allows you to visually create your environment through a drag-and-drop interface which allows CloudFormation to automatically create a template for you based off of your design. It can also be used to view your templates in a graphical way and make changes to it. Through the use of an inbuilt JSON and YAML editor you can then configure and edit the resources used within the Designer interface to match the parameters that you need. 

That now brings me to the end of this lecture. Coming up next I will demonstrate how to create a CloudFormation stack using a sample template.

About the Author

William Meadows is a passionately curious human currently living in the Bay Area in California. His career has included working with lasers, teaching teenagers how to code, and creating classes about cloud technology that are taught all over the world. His dedication to completing goals and helping others is what brings meaning to his life. In his free time, he enjoys reading Reddit, playing video games, and writing books.