AWS CloudFormation
AWS CloudFormation
CloudFormation offers granular control over the provisioning and management of all application infrastructure components, from low-level components such as route tables or subnet configurations, to high-level components such as CloudFront distributions. CloudFormation is commonly used with other AWS deployment services or third-party tools; combining CloudFormation with more specialized deployment services to manage deployments of application code onto infrastructure components.
AWS offers extensions to the CloudFormation service in addition to its base features:
-
AWS Cloud Development Kit (AWS CDK)
(AWS CDK) is an open source software development kit (SDK) to programmatically model AWS infrastructure with TypeScript, Python, Java, or .NET. -
AWS Serverless Application Model
(SAM) is an open source framework to simplify building serverless applications on AWS.
Table 1: AWS CloudFormation deployment features
Capability | Description |
---|---|
Provision |
CloudFormation will automatically create and update infrastructure components that are defined in a template. Refer to AWS CloudFormation Best Practices for more details on creating infrastructure using CloudFormation templates. |
Configure |
CloudFormation templates offer extensive flexibility to customize and update all infrastructure components. Refer to CloudFormation Template Anatomy for more details on customizing templates. |
Deploy |
Update your CloudFormation templates to alter the resources in a stack. Depending on your application architecture, you may need to use an additional deployment service to update the application version running on your infrastructure. Refer to Deploying Applications on EC2 with AWS CloudFormation for more details on how CloudFormation can be used as a deployment solution. |
Scale | CloudFormation will not automatically handle infrastructure scaling on your behalf; however, you can configure auto scaling policies for your resources in a CloudFormation template. |
Monitor |
CloudFormation provides native monitoring of the success or failure of updates to infrastructure defined in a template, as well as “drift detection” to monitor when resources defined in a template do not meet specifications. Additional monitoring solutions will need to be in place for application-level monitoring and metrics. Refer to Monitoring the Progress of a Stack Update for more details on how CloudFormation monitors infrastructure updates. |
The following diagram shows a common use case for CloudFormation. Here, CloudFormation templates are created to define all infrastructure components necessary to create a simple three-tier web application. In this example, we are using bootstrap scripts defined in CloudFormation to deploy the latest version of our application onto EC2 instances; however, it is also a common practice to combine additional deployment services with CloudFormation (using CloudFormation only for its infrastructure management and provisioning capabilities). Note that more than one CloudFormation template is used to create the infrastructure.

Figure 1: AWS CloudFormation use case