AWS CloudFormation Operations
The course is part of this learning path
This section of the SysOps Administrator - Associate learning path introduces you to automation and optimization services relevant to the SOA-C02 exam. We will understand the service options available and learn how to apply these designs and solutions to meet specific design scenarios relevant to the exam.
- Understand how to decouple architecture using Amazon Simple Notification Service and the Simple Queue Service
- Learn how AWS CloudFormation can be used to optimize and speed up your deployments using infrastructure as Code (IaC)
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.
Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.
To date, Stuart has created 150+ courses relating to Cloud reaching over 180,000 students, mostly within the AWS category and with a heavy focus on security and compliance.
Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.
He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.
In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.
Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.