CloudFormation vs Terraform comes down to scope and state. AWS CloudFormation is AWS’s own infrastructure-as-code service: you describe AWS resources in JSON or YAML templates, and AWS manages the deployment and its state for you. Terraform is a third-party tool that uses its own language (HCL) and providers to manage AWS and many other platforms, with a state file that you store and protect yourself. On AWS exams, CloudFormation (or AWS CDK, which generates CloudFormation) is the default answer for AWS-only infrastructure. Terraform is right when the question mentions multi-cloud, existing Terraform code, or third-party IaC tools, which the SOA-C03 guide now names explicitly.
Facts verified November 2026 against the SOA-C03 exam guide and the AWS CloudFormation User Guide.
CloudFormation vs Terraform at a glance
In short: choose CloudFormation for AWS-only infrastructure managed entirely by AWS, and Terraform when you need one tool and language across several clouds or services.
| AWS CloudFormation | Terraform | |
|---|---|---|
| Made by | AWS | HashiCorp (third party) |
| Language | JSON or YAML templates. AWS CDK lets you write TypeScript, Python, Java, C# or Go, which it turns into CloudFormation | HCL (HashiCorp Configuration Language) |
| Platforms | AWS (plus third-party resource types through the CloudFormation registry) | AWS, other clouds and many SaaS services through providers |
| State | Managed by AWS as a stack. Nothing to store | A state file you store, secure and lock, for example in Amazon S3 |
| Preview changes | Change sets | terraform plan |
| Rollback on failure | Automatic by default | No automatic rollback. You fix and re-apply |
| Detect manual changes | Drift detection (stacks, resources and StackSets) | terraform plan shows differences from the configuration |
| Multi-account and multi-Region | StackSets | Separate configurations, workspaces or modules per account and Region |
| Cost | No charge for AWS resource types. You pay for the resources created; handler operations for third-party types are charged | The CLI is free to use. Paid HashiCorp products add collaboration features |
| License | AWS service | Business Source License since August 2023 (it was previously open source) |
Choose CloudFormation when…
- The infrastructure is AWS-only and you want AWS to manage state, rollback and dependencies.
- You deploy the same stack to many accounts or Regions. StackSets do this from one place, which is a frequent SOA-C03 answer.
- You want automatic rollback if a deployment fails partway.
- You want to detect drift, meaning manual console changes, and bring resources back under control, including importing existing resources into a stack.
- Developers prefer real programming languages. Use AWS CDK, which produces CloudFormation templates and deploys them as stacks.
Choose Terraform when…
- You manage more than AWS: several cloud providers, or services such as DNS, monitoring or Git hosting, all from one tool and workflow.
- The team already has Terraform modules and pipelines. Rewriting working code in CloudFormation brings little benefit.
- The question names Terraform, or says “third-party infrastructure-as-code tool”. The SOA-C03 guide asks you to use and manage third-party tools such as Terraform and Git to automate deployment.
What does the exam actually test?
SOA-C03 lists AWS CloudFormation and AWS CDK as in-scope services, and adds a skill on third-party automation tools, with Terraform and Git as its examples. Domain 3 (Deployment, Provisioning, and Automation) is 22% of the exam. So expect plenty of CloudFormation detail, and know enough Terraform to recognize when it’s the right tool and how its state is stored on AWS.
SAA-C03 treats infrastructure as code more lightly: CloudFormation as the way to deploy repeatable, consistent environments.
| SOA-C03 skill (Domain 3) | What to know |
|---|---|
| Create and manage resources with CloudFormation and AWS CDK | Templates, parameters, outputs and exports, change sets, rollback, deletion policies, CDK synthesizing to CloudFormation |
| Provision and share resources across Regions and accounts | CloudFormation StackSets, AWS Resource Access Manager |
| Use and manage third-party tools (for example Terraform, Git) | Terraform plan and apply, state in S3 with locking, why state must be protected |
| Troubleshoot deployments | Stack events, failed resource creation, drift, DO_NOTHING on failure to keep resources for debugging |
Exam cues: which answer the question wants
| Cue in the question | Likely answer | Exam |
|---|---|---|
| “Provision AWS resources repeatably using templates” | AWS CloudFormation | CLF-C02, SAA-C03 |
| “Deploy the same stack to multiple accounts and Regions” | CloudFormation StackSets | SOA-C03, SAA-C03 |
| “Preview the changes before updating a stack” | CloudFormation change sets | SOA-C03 |
| “Find resources changed manually outside the template” | CloudFormation drift detection | SOA-C03 |
| “Bring existing resources under CloudFormation management” | Resource import | SOA-C03 |
| “Developers want to define infrastructure in Python or TypeScript” | AWS CDK | SOA-C03 |
| “Manage AWS and another cloud provider with one tool” | Terraform | SOA-C03 |
| “Store Terraform state securely and prevent concurrent changes” | S3 backend with state locking | SOA-C03 |
| “Share one stack’s resource with other stacks” | Outputs with Export and Fn::ImportValue | SOA-C03 |
Worked example 1: the multi-account rollout
A company uses AWS Organizations with 40 accounts. The security team must deploy the same set of IAM roles and an AWS Config rule to every account in two Regions, and new accounts must receive them automatically. Which solution requires the LEAST operational effort?
Everything here is AWS-native: IAM roles, a Config rule, Organizations. “Every account in two Regions” and “new accounts automatically” point to CloudFormation StackSets with service-managed permissions and automatic deployment turned on. You create the stack set once and target the organization or specific organizational units, and new accounts get the stack when they join. Terraform could do it, but you’d have to run it against each account and Region and build the new-account trigger yourself. That’s more effort, and the question gives no reason to leave AWS-native tooling.
Worked example 2: the multi-cloud team
A company manages infrastructure on AWS and another cloud provider. Its platform team wants one tool and one language for both, with a reviewable plan before every change. On AWS, the state must be stored centrally and protected against two engineers applying changes at the same time. What should the team do?
“Two cloud providers” and “one tool and one language” rule out CloudFormation, which only manages AWS (third-party resource types don’t make it a multi-cloud tool for the whole estate). Terraform fits: its providers cover both clouds, and terraform plan gives the reviewable preview. The second half of the question is about state. Terraform’s state file maps the configuration to real resources, and it can contain sensitive values. Storing it in an S3 bucket, with versioning, encryption and restricted access, plus state locking, prevents corruption from simultaneous runs. That’s the full answer the exam looks for.
Common CloudFormation vs Terraform traps
- “Terraform is an AWS service.” It isn’t. On AWS exams, the AWS-native default is CloudFormation or CDK unless the question gives a reason for Terraform.
- Forgetting Terraform state. Losing or corrupting the state file breaks Terraform’s view of your infrastructure. Store it remotely, encrypt it and lock it.
- CDK vs CloudFormation. They aren’t rivals: CDK generates CloudFormation and deploys it as a stack. If a question asks for code in a programming language plus CloudFormation features, the answer is CDK.
- StackSets vs nested stacks. StackSets deploy across accounts and Regions. Nested stacks reuse templates inside one stack.
- Rollback behavior. CloudFormation rolls back failed creations by default. To keep resources for troubleshooting, set
OnFailuretoDO_NOTHING, or preserve successfully provisioned resources in the console. - Drift isn’t fixed automatically. Drift detection reports differences. You then update the template, re-deploy, or use resource import to bring resources back in line.
CloudFormation vs Terraform FAQ
Is CloudFormation free?
There’s no extra charge for managing AWS resource types. You pay for the resources the stack creates. Handler operations for third-party resource types in the CloudFormation registry are charged per operation.
Is Terraform on the AWS exams?
Yes, on SOA-C03. The exam guide names Terraform as an example of a third-party tool for automating deployments. Expect recognition and good-practice questions, not Terraform syntax.
Which is better for AWS-only projects?
For exam purposes, CloudFormation or AWS CDK. In practice, both tools work well on AWS. Teams often choose based on existing skills and whether they also manage other platforms.
What is the difference between AWS CDK and CloudFormation?
CDK is a framework for defining infrastructure in programming languages. It synthesizes CloudFormation templates and deploys them as CloudFormation stacks, so you keep CloudFormation’s state management and rollback.
Where should Terraform state be stored on AWS?
In an Amazon S3 bucket configured as Terraform’s backend, with versioning, encryption, restricted access and state locking turned on.
Test yourself
Infrastructure as code is a big part of SOA-C03 Domain 3. Try our free AWS CloudOps Engineer practice exam, then take a full timed test:
Free mock exam
Practice like it’s exam day.
A full-length, timed mock in the real exam format, with every answer explained so you know exactly where you stand.
65
questions
130
minutes
720
to pass
Free account required.
The full set is in our SOA-C03 practice exams. Studying for Solutions Architect? Try the free SAA practice exam.
Read the SOA-C03 exam guide, and see how the exam changed in the SysOps to CloudOps rename.
AWSBoy is not affiliated with Amazon Web Services or HashiCorp. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. Terraform is a trademark of HashiCorp.
Sources (checked November 2026): SOA-C03 exam guide, Domain 3 · AWS CloudFormation User Guide · Detecting drift · Importing existing resources · AWS CloudFormation pricing · AWS CDK Developer Guide · Terraform S3 backend




