Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is CloudFormation and infrastructure as code on AWS?

Infrastructure as code means declaring your infrastructure in version-controlled files rather than clicking through the console. The benefits are reproducibility, code review on infrastructure changes, drift detection, and disaster recovery becoming a pipeline run rather than an archaeology exercise.

The options on AWS:

  • CloudFormation — the native service. You write a YAML or JSON template describing resources, and CloudFormation creates them as a stack, handling dependency ordering and, importantly, rolling back automatically if creation fails. Change sets preview what an update will do before you apply it — always use them on anything important. StackSets deploy the same template across many accounts and regions.
  • AWS CDK — define infrastructure in TypeScript, Python, Java, or Go, which synthesises to CloudFormation. You get loops, conditionals, type checking, and reusable constructs, which makes large infrastructures far more manageable than raw YAML.
  • Terraform — multi-cloud, with a large module ecosystem and its own state file to manage. Frequently chosen where an organisation is not AWS-only.
  • SAM — a CloudFormation extension with concise syntax for serverless applications.

Note: The practical caution is drift — someone changing a resource in the console breaks the template's assumptions. Detect it with drift detection, and prevent it by restricting console write access in production so the pipeline is the only path to change.

All AWS interview questions

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as