Amazon Web Services CloudFormation
is an Infrastructure as Code (IaC) service that allows you to model your cloud resources in template files that can be authored or generated in a variety of languages. You can manage stacks that deploy those resources via the
Amazon Web Services Management Console
, the
Amazon Web Services Command Line Interface (Amazon Web Services CLI)
, or the API. CloudFormation helps customers to quickly and consistently deploy and manage cloud resources, but like all IaC tools, it faced challenges keeping up with the rapid pace of innovation of Amazon Web Services services. In this post, we will review the history of the
CloudFormation registry
, which is the result of a strategy we developed to address scaling and standardization, as well as integration with other leading IaC tools and partner products. We will also give an update on the current state of CloudFormation resource coverage and review the future state, which has a goal of keeping CloudFormation and other IaC tools up to date with the latest Amazon Web Services services and features.
History
The CloudFormation service was
first announced
in February of 2011, with sample templates that showed how to deploy common applications like blogs and wikis. At launch, CloudFormation supported 13 out of 15 available Amazon Web Services services with 48 total resource types. At first, resource coverage was tightly coupled to the core CloudFormation engine, and all development on those resources was done by the CloudFormation team itself. Over the past decade, Amazon Web Services has grown at a rapid pace, and there are currently 200+ services in total. A challenge over the years has been the coverage gap between what was possible for a customer to achieve using Amazon Web Services services, and what was possible to define in a CloudFormation template.
It became obvious that we needed a change in strategy to scale resource development in a way that could keep up with the rapid pace of innovation set by hundreds of service teams delivering new features on a daily basis. Over the last decade, our pace of innovation has increased nearly 40-fold, with 80 significant new features launched in 2011 versus more than 3,000 in 2021. Since CloudFormation was a key adoption driver (or blocker) for new Amazon Web Services services, those teams needed a way to create and manage their own resources. The goal was to enable day one support of new services at the time of launch with complete CloudFormation resource coverage.
In 2016, we launched an internal self-service platform that allowed service teams to control their own resources. This began to solve the scaling problems inherent in the prior model where the core CloudFormation team had to do all the work themselves. The benefits went beyond simply distributing developer effort, as the service teams have deep domain knowledge on their products, which allowed them to create more effective IaC components. However, as we developed resources on this model, we realized that additional design features were needed, such as standardization that could enable automatic support for features like drift detection and resource imports.
We embarked on a new project to address these concerns, with the goal of improving the internal developer experience as well as providing a public registry where customers could use the same programming model to define their own resource types. We realized that it wasn’t enough to simply make the new model available—we had to evangelize it with a training campaign, conduct engineering boot-camps, build better tooling like dashboards and deployment pipeline templates, and produce comprehensive on-boarding documentation. Most importantly, we made CloudFormation support a required item on the feature launch checklist for new services, a requirement that goes beyond documentation and is built into internal release tooling (exceptions to this requirement are rare as training and awareness around the registry have improved over time). This was a prime example of one of the maxims we repeat often at Amazon: good mechanisms are better than good intentions.
In 2019, we made this new functionality available to customers when we
announced the CloudFormation registry
, a capability that allowed developers to create and manage private resource types. We followed up in 2021 with the
public registry
where third parties, such as partners in the Amazon Web Services Partner Network (APN), can publish extensions. The open source resource model that customers and partners use to publish third-party registry extensions is the same model used by Amazon Web Services service teams to provide CloudFormation support for their features.
Once a service team on-boards their resources to the new resource model and builds the expected Create, Read, Update, Delete, and List (CRUDL) handlers, managed experiences like
drift detection
and
resource import
are all supported with no additional development effort. One recent example of day-1 CloudFormation support for a popular new feature was
Lambda Function URLs
, which offered a built-in HTTPS endpoint for single-function micro-services. We also migrated the
Amazon Relational Database Service (Amazon RDS)
Database Instance resource (Amazon Web Services::RDS::DBInstance) to the new resource model in September 2022, and within a month,
Amazon RDS delivered support for Amazon Aurora Serverless v2 in CloudFormation
. This accelerated delivery is possible because teams can now publish independently by taking advantage of the de-centralized Registry ownership model.
Current State
We are building out future innovations for the CloudFormation service on top of this new standardized resource model so that customers can benefit from a consistent implementation of event handlers. We built
Amazon Web Services Cloud Control API
on top of this new resource model. Cloud Control API takes the Create-Read-Update-Delete-List (CRUDL) handlers written for the new resource model and makes them available as a consistent API for provisioning resources. APN partner products such as HashiCorp Terraform, Pulumi, and Red Hat Ansible use Cloud Control API to stay in sync with Amazon Web Services service launches without recurring development effort.
Figure 1. Cloud Control API Resource Handler Diagram
Besides 3rd party application support, the public registry can also be used by the developer community to create useful extensions on top of Amazon Web Services services. A common solution to extending the capabilities of CloudFormation resources is to write a
custom resource
, which generally involves inline Amazon Web Services Lambda function code that runs in response to CREATE
, UPDATE
, and DELETE
signals during stack operations. Some of those use cases can now be solved by writing a registry extension resource type instead. For more information on custom resources and resource types, and the differences between the two, see
Managing resources using Amazon Web Services CloudFormation Resource Types
.
CloudFormation
Registry modules, which are building blocks authored in JSON or YAML, give customers a way to replace fragile copy-paste template reuse with template snippets that are published in the registry and consumed as if they were resource types. Best practices can be encapsulated and shared across an organization, which allows infrastructure developers to easily adhere to those best practices using modular components that abstract away the intricate details of resource configuration.
CloudFormation Registry hooks
give security and compliance teams a vital tool to validate stack deployments before any resources are created, modified, or deleted. An infrastructure team can activate hooks in an account to ensure that stack deployments cannot avoid or suppress preventative controls implemented in hook handlers. Provisioning tools that are strictly client-side do not have this level of enforcement.
A useful by-product of publishing a resource type to the public registry is that you get automatic support for the Amazon Web Services Cloud Development Kit (CDK) via an experimental open source repository on GitHub called
cdk-cloudformation
. In large organizations it is typical to see a mix of CloudFormation deployments using declarative templates and deployments that make use of the CDK in languages like TypeScript and Python. By publishing re-usable resource types to the registry, all of your developers can benefit from higher level abstractions, regardless of the tool they choose to create and deploy their applications. (Note that this project is still considered a developer preview and is subject to change)
If you want to see if a given CloudFormation resource is on the new registry model or not, check if the provisioning type is either Fully Mutable
or Immutable
by invoking the
DescribeType API
and inspecting the ProvisioningType
response element.
Here is a sample CLI command that gets a description for the Amazon Web Services::Lambda::Function resource, which is on the new registry model.
$ aws cloudformation describe-type --type RESOURCE \
--type-name AWS::Lambda::Function | grep ProvisioningType
"ProvisioningType": "FULLY_MUTABLE",
The difference between FULLY_MUTABLE
and IMMUTABLE
is the presence of the Update handler. FULLY_MUTABLE
types includes an update handler to process updates to the type during stack update operations. Whereas, IMMUTABLE
types do not include an update handler, so the type can’t be updated and must instead be replaced during stack update operations. Legacy resource types will be NON_PROVISIONABLE
.
Opportunities for improvement
As we continue to strive towards our ultimate goal of achieving full feature coverage and a complete migration away from the legacy resource model, we are constantly identifying opportunities for improvement. We are currently addressing feature gaps in supported resources, such as
tagging support for EC2 VPC Endpoints
and boosting coverage for resource types to support drift detection, resource import, and Cloud Control API. We have fully migrated more than 130 resources, and acknowledge that there are many left to go, and the migration has taken longer than we initially anticipated. Our top priority is to maintain the stability of existing stacks—we simply cannot break backwards compatibility in the interest of meeting a deadline, so we are being careful and deliberate. One of the big benefits of a server-side provisioning engine like CloudFormation is operational stability—no matter how long ago you deployed a stack, any future modifications to it will work without needing to worry about upgrading client libraries. We remain committed to streamlining the migration process for service teams and making it as easy and efficient as possible.
The developer experience for creating registry extensions has some rough edges, particularly for languages other than Java, which is the language of choice on Amazon Web Services service teams for their resource types. It needs to be easier to author schemas, write handler functions, and test the code to make sure it performs as expected. We are devoting more resources to the maintenance of the
CLI
and plugins for
Python
,
Typescript
, and
Go
. Our response times to issues and pull requests in these and other repositories in the
aws-cloudformation
GitHub organization have not been as fast as they should be, and we are making improvements. One example is the
cloudformation-cli
repository, where we have merged more than 30 pull requests since October of 2022.
To keep up with progress on resource coverage, check out the
CloudFormation Coverage Roadmap
, a GitHub project where we catalog all of the open issues to be resolved. You can submit bug reports and feature requests related to resource coverage in this repository and keep tabs on the status of open requests. One of the steps we took recently to improve responses to feature requests and bugs reported on GitHub is to create a system that converts GitHub issues into tickets in our internal issue tracker. These tickets go directly to the responsible service teams—an example is the
Amazon RDS resource provider
, which has hundreds of merged pull requests.
We have recently announced a new GitHub repository called
community-registry-extensions
where we are managing a namespace for public registry extensions. You can submit and discuss new ideas for extensions and contribute to any of the related projects. We handle the testing, validation, and deployment of all resources under the AwsCommunity::
namespace, which can be activated in any Amazon Web Services account for use in your own templates.
To get started with the CloudFormation registry, visit the
user guide
, and then dive in to the detailed developer guide for information on how to use the
CloudFormation Command Line Interface (CFN-CLI)
to write your own resource types, modules, and hooks.
We recently created a new
Discord server dedicated to CloudFormation
. Please join us to ask questions, discuss best practices, provide feedback, or just hang out! We look forward to seeing you there.
Conclusion
In this post, we hope you gained some insights into the history of the CloudFormation registry, and the design decisions that were made during our evolution towards a standardized, scalable model for resource development that can be shared by Amazon Web Services service teams, customers, and APN partners. Some of the lessons that we learned along the way might be applicable to complex design initiatives at your own company. We hope to see you on Discord and GitHub as we build out a rich set of registry resources together!
About the authors: