The course is part of this learning path
As AWS-based cloud environments grow in complexity, DevOps Professionals need to adopt more powerful tools and techniques to manage complex deployments. In the AWS ecosystem, CloudFormation is the most powerful and sophisticated automation tool available to developers. AWS CloudFormation can be used to automatically provision your AWS resources across multiple accounts and regions all from a simple text file. In this course, I will explain the components of this service and how they operate together to provide you with this feature of provisioning your infrastructure as code.
By the end of this course you will be able to:
- 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
This course is intended for DevOps and SysOps engineers, as well as Architects who have a level of responsibility when it comes to deploying, provisioning, managing and maintaining resources within your AWS infrastructure
As a prerequisite of this course, it would be beneficial to you to have an understanding of basic AWS concepts and core services
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
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, Designer and CloudFormer. 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 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.
CloudFormer. CloudFormer is a tool that allows you to replicate existing infrastructure that wasn't deployed using CloudFormation, and as a result, does not contain a stack or template that reflects its configuration. If you had an existing solution that you want to replicate and deploy with ease, then CloudFormer is a great solution to do so. You can configure CloudFormer during the creation of a stack. When preparing your template you can select to Use a sample template, and then select CloudFormer from the drop-down list.
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
Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data centre and network infrastructure design, to cloud architecture and implementation.
To date, Stuart has created 50+ courses relating to Cloud, most within the AWS category with a heavy focus on security and compliance
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.