What is AWS CloudFormation and how can it help your IaC efforts?
CloudFormation is a powerful Infrastructure as Code tool that can help automate and manage your AWS deployments.
This is the fourth article in our Infrastructure as Code blog series. You can read the first three here:
- Infrastructure as Code: 5 Reasons Why You Should Implement IaC Now
- Infrastructure as Code: 6 best practices to get the most out of IaC
- 15 Infrastructure as Code tools you can use to automate your deployments
In future posts, we will provide you with CloudFormation templates and analyze what they do and how they work.
Our prior Infrastructure as Code article highlighted 15 popular IaC tools you can use to automate your deployments. One of the tools we wrote about is CloudFormation, which is the IaC tool offered by the largest cloud service provider in the world, Amazon Web Services.
In 2017, over 350,000 AWS customers used AWS CloudFormation to deploy and manage over 2.4 million infrastructure stacks. Impressive.
In this article, we’ll take a look at:
- What CloudFormation’s primary features are
- How CloudFormation can be used with other IaC tools
- What companies use CloudFormation
What is CloudFormation?
AWS CloudFormation is a configuration orchestration tool that allows you to codify your infrastructure to automate your deployments.
CloudFormation templates can be created with YAML in addition to JSON. Or you can use AWS CloudFormation Designer to visually create your templates and see the interdependencies of your resources.
CloudFormation takes a declarative approach to configuration, meaning that you tell it what you want your environment to look like, and it finds its way there.
During this configuration process, CloudFormation automatically manages dependencies between your resources. Thus, you don’t have to specify the order in which resources are created, updated, or deleted. CloudFormation automatically determines the correct sequence of actions to create your environment, though you can use the DependsOn attribute, wait condition handlers, and nested stacks to specify the order of operations, if necessary.
Sometimes updating an infrastructure stack can cause anxiety because you’re not sure what changes might break the environment. Not to fear! CloudFormation Change Sets allow you to preview how your resources will be impacted before any changes are executed. Only after you execute your change set will your stack be edited.
Even if you execute a change set that has errors in it, CloudFormation has Rollback Triggers that allow you to monitor your stack creation or update process and roll back your environment to a previous state. You can specify thresholds to monitor in CloudWatch and integrate them into your CloudFormation templates. When these thresholds are exceeded, the Rollback Triggers revert your environment back to the previously deployed state.
CloudFormation StackSets allow you to deploy, update, or delete infrastructure stacks across multiple AWS regions and accounts with a single CloudFormation template. Before StackSets existed, every infrastructure environment had to be deployed independently, and custom scripts had to be written to deploy these stacks to multiple accounts and regions. StackSets now make it much easier to maintain consistency when you add new regions and accounts.
And Custom Resources let you write custom provisioning logic in your CloudFormation scripts. For instance, if you’d like to define resources that CloudFormation doesn’t support yet, or if you need to create a resource that’s specific to your use case, Custom Resources allows you to manage all of this in a single stack.
CloudFormation supports many AWS services. AWS frequently releases additional useful functionality, so the sky’s the limit on the things you can do with CloudFormation.
Combining CloudFormation with other IaC tools
As mentioned in our prior post about IaC tools, CloudFormation is a configuration orchestration tool, which is used to automate the deployment of servers and other infrastructure like databases and load balancers.
CloudFormation is often used in conjunction with configuration management tools, which are designed to configure the software and systems that run on this infrastructure.
This combination provides seamless deployment and configuration of AWS infrastructure and the applications that run on top of it.
Let’s say that you want to build a SaaS data analytics application on AWS. You can use a CloudFormation template to provision a web server on EC2, a DynamoDB database, and any other AWS resources you need. Then you can install a configuration management tool to set up the operating systems and software on these EC2 instances.
Chef and Puppet are the most popular configuration management products used with CloudFormation, and AWS has a product called OpsWorks that provides managed instances of these tools.
The combination of CloudFormation with configuration management tools allows you to automate the configuration, deployment, and management of cloud resources and the software that run on them from a single template. This greatly improves the efficiency and consistency of your infrastructure deployments.
Companies who use CloudFormation
If you use CloudFormation to automate your deployments, you’re in good company.
Nextdoor
Nextdoor is a private social network for local neighbors to connect with each other and share community news. The company has over 160,000 neighborhoods across the globe and more than 10 million users on its platform.
Nextdoor uses CloudFormation templates for flexible, one-click server deployment and network creation. They also use Puppet to define and configure the software and operating systems that run on these AWS servers.
Coinbase
Coinbase is the largest consumer Bitcoin wallet in the world. Over 10 million users have purchased or traded over $50 billion worth of cryptocurrencies through their platform.
Most if not all of Coinbase’s infrastructure is designed and managed with CloudFormation templates. This allows the company to easily replicate infrastructure stacks for all phases of their development process and provides version control to ensure their environments are configured correctly over time.
Expedia
Expedia Group is one of the largest travel booking companies in the world, with well-known brands such as Expedia.com, Hotels.com, Travelocity, and many more. In 2017, the company had $88.4 billion of gross bookings through its various platforms.
The global company has a multi-region, multi-availability zone architecture, and uses CloudFormation in combination with Chef to deploy its entire front and backend stack into its Amazon Virtual Private Cloud environment.
Conclusion
As you can see, AWS is a really powerful tool that many large and influential companies use to deploy and manage their infrastructure stacks.
We primarily work with AWS, so we’re all over CloudFormation. And we’ve built a couple of products on the AWS Marketplace (SFTP Gateway and WP SureStack) using CloudFormation, so we understand the power that it can have in automating AWS infrastructure deployments.
In our next post, we’ll provide a few CloudFormation templates we created and walk you through exactly what’s going on in each of them. Sign up below to receive our next article via email.
Like this post? It likes you too. :)
If you enjoyed this post, please give it some claps so others can discover it more easily!
This article was originally published on ThornTech.com.