Management and Governance
AWS CloudFormation
Infrastructure as code service: you describe the AWS resources you want in a template, and CloudFormation provisions and configures them as a single unit (a stack). It lets you replicate infrastructure consistently and manage its changes as if it were code.
Exam phrases that point here
«provision infrastructure as code in a repeatable and predictable way»
CloudFormation creates and manages a set of related resources from a declarative template: the same file produces the same environment every time, with version control and automatic rollback.
When not: If the team only wants to upload a web application's code and have AWS handle capacity and deployment, AWS Elastic Beanstalk fits (it uses CloudFormation under the hood). If it prefers to define the infrastructure with a programming language, there is the AWS CDK, which generates CloudFormation templates.
«replicate the same environment in another Region or for another team»
A parameterized template can be deployed as many times as needed; CloudFormation generates unique names from the stack name so that stacks do not collide with each other.
When not: The template recreates the infrastructure, not the data: for disaster recovery you have to replicate or back up the data separately (snapshots, cross-Region replication, AWS Backup). If it has to be repeated across many accounts and Regions at once, the clue points to StackSets.
«review the impact of a change before applying it to production infrastructure»
A change set compares the current stack with the new template or parameters and shows which resources will be added, modified, replaced, or deleted, without touching anything until it is executed.
When not: A change set does not guarantee that the update will complete successfully: some failures only appear when it is executed. And if the question is how to discover changes made by hand outside CloudFormation, it is about drift detection, not a change set.
«deploy the same configuration to multiple accounts and Regions from a single place»
A StackSet uses a single template to create, update, or delete stacks in the chosen accounts and Regions; with service-managed permissions and AWS Organizations, it also deploys to new accounts in an OU.
When not: If the question asks for teams to launch approved products on their own with limited permissions, AWS Service Catalog fits. If it asks for a whole multi-account environment with controls already included, AWS Control Tower, which uses StackSets internally.
«keep the data when the stack is deleted»
A resource's deletion policy (DeletionPolicy) lets you retain it or create a snapshot, for example of an EBS volume or an RDS database, when the stack is deleted.
When not: It only takes effect when the stack or the resource is deleted. For periodic copies retained according to a policy, the service is AWS Backup or scheduled snapshots.
«install and configure software on instances when the stack is created»
CloudFormation can pass bootstrap scripts to EC2 instances (user data and its helper scripts) and wait for the application to signal that it has started before considering the stack created.
When not: If the task is to configure, patch, or run commands on servers that already exist, on an ongoing basis, AWS Systems Manager fits. For pre-built images, you start from your own AMI.
Often paired with
- AWS Service Catalog