Cloud Security Maturity Model·AWS v3.0.0

Drag to explore · pinch to zoom

Efficient Security governance

c3.2 Use infrastructure as code

Describe infrastructure as code with CloudFormation, the AWS CDK, or Terraform. IaC brings versioning and change management, lets you scan templates for issues before deploy, and makes rebuilding a compromised environment fast and repeatable.

Implementation guidance

Build infrastructure from versioned code

Define your infrastructure with AWS CloudFormation, the AWS CDK, or third-party tools such as HashiCorp Terraform. Infrastructure as code (IaC) improves governance, versions your architecture, feeds it into change management, and lets you rebuild a compromised environment quickly and consistently.

Adopting IaC early pays off, but retrofitting templates onto existing infrastructure is not trivial. If your organization will eventually move to IaC, prioritize starting sooner.

Scan templates before you deploy

Catch misconfigurations before they exist by validating templates in the pipeline:

Validate before you deploy

Gate the pipeline on a policy check — for example, fail the build if a template violates your CloudFormation Guard rules:

cfn-guard validate \
  --data template.yaml \
  --rules security-rules.guard

How to validate

  • Is your infrastructure defined as code and kept under version control?
  • Do you scan IaC templates for security issues before deploy (for example CloudFormation Guard, checkov)?
  • Could you rebuild a compromised environment from code quickly?

Threats addressed

  • Manually built infrastructure drifts, is hard to audit, and is slow to rebuild after a compromise; unreviewed changes can silently introduce insecure configurations.

AWS services

AWS CloudFormation

Pricing

No additional charge

AWS CloudFormation itself is free — you pay only for the resources it provisions. See CloudFormation pricing.

Framework mappings

AWS CAF

Well-Architected

References