Skip to Content
Cloud Engineering Academy
10. Infrastructure as Code

Module 10 cheat sheet

One-page revision summary for Infrastructure as Code: tools, .NET and Azure mapping, CLI commands, limits, decision rules, exam traps and cost traps.

DOP-C02SOA-C03SAP-C03

Assumes: AWS CLI v2 · Amazon.CDK.Lib 2.277.0 · Cdklabs.CdkNag 3.0.2 · Terraform 1.17.2 · AWS provider 6.73.0 · .NET 10 LTS · Region us-east-1 · facts as stated in the Module 10 lessons (checked 2026-11-18). Verified against official sources on 2026-11-18.

A printable summary of Module 10. Rows link back to the lesson with the detail.

Key tools and services

Tool or serviceWhat it is forLesson
CloudFormationDeclarative stacks, change sets, rollback, drift detectionFundamentals
StackSetsRoll one template out to many accounts and RegionsDrift and StackSets
AWS CDK (C#)Real C# that synthesizes CloudFormation; L1 raw, L2 defaults, L3 patternsFirst stack, Constructs
CDK stacks and bootstrapStacks by lifecycle, typed per-environment settings, deploy rolesStacks and environments
xUnit + cdk-nagAssertion tests on the synthesized template; rule packs with justified suppressionsTesting CDK
Terraform + AWS providerHCL, plan/apply, one tool across providersFundamentals
Terraform state in S3Remote, encrypted, locked state (use_lockfile)State
Terraform modulesReusable, versioned building blocksModules
Checkov, cfn-nag, CloudFormation GuardPolicy checks on code, templates and plansPolicy-as-code
Control Tower, Account Factory, AFT, CfCTGoverned multi-account landing zoneLanding zones

.NET / Azure to AWS

Microsoft / AzureAWS
ARM templateCloudFormation template
BicepAWS CDK in C#
Terraform with azurermTerraform with the AWS provider
What-if / deployment stacksChange set / terraform plan
Azure Policy, template analysiscdk-nag, Checkov, cfn-nag, CloudFormation Guard
Template specsCloudFormation modules, CDK construct libraries, Terraform modules
Management groups + landing zone acceleratorOrganizations + Control Tower + Account Factory
Storage account holding stateS3 bucket with KMS and use_lockfile

Most useful commands

TaskCommand
Lint / validate a templatecfn-lint template.yaml · aws cloudformation validate-template --template-body file://template.yaml
Review before applyingaws cloudformation create-change-set then describe-change-set, execute-change-set
Recover a stuck rollbackaws cloudformation continue-update-rollback --stack-name <name>
Detect driftaws cloudformation detect-stack-drift · describe-stack-drift-detection-status · describe-stack-resource-drifts
CDK cyclecdk bootstrap · cdk synth · cdk diff · cdk deploy · cdk destroy
Terraform cycleterraform init · plan -out · apply · destroy
Terraform state workterraform state list · terraform import · terraform workspace list
Test without an accountdotnet test (CDK, needs Node.js) · terraform test (mock provider)
Find leftoversaws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=cea-lab

Key limits and defaults

ItemValue
CloudFormation template500 resources, 200 parameters, 200 outputs, 200 mappings
Template body in a request51,200 bytes; upload to S3 for up to 1 MB
Deletion policy defaultDelete (a non-empty S3 bucket then fails to delete)
UpdateReplacePolicySeparate from DeletionPolicy; applies when an update replaces the resource
KMS key deletion windowMinimum 7 days
Drift detectionPoint-in-time, manual or scheduled; needs read access to every resource type; only template properties are compared
StackSets quotas1,000 StackSets per administrator account; 100,000 stack instances per StackSet
Terraform lockinguse_lockfile = true (S3 conditional writes); DynamoDB locking is deprecated
CDK dependencyNeeds Node.js 22 or 24 LTS even for C# apps
Lab tests50; 22 pass and 28 skip without Node.js; CI=true makes a missing Node a failure

Decision rules

If you need…Choose
AWS-only, C# team, testable infrastructureCDK in C#
Several clouds or non-AWS providersTerraform
Full control of the raw template, or services that deploy CloudFormation for youCloudFormation
One approved pattern for many teamsCDK L3 construct or Terraform module
Same template in many accountsStackSets (service-managed, with auto-deployment)
Bring a hand-built resource under codeCloudFormation IMPORT change set or terraform import
Differences between dev, test and prodOne typed settings profile over one codebase
Protect stateful resourcesRetain or snapshot policy, deletion protection, prevent_destroy, stack policy, plan guard
Pipeline accessRead-only plan role plus narrow apply role via OIDC
New accounts on demandControl Tower Account Factory driven from Git

Common exam traps

  • Renaming a CDK logical ID or construct ID replaces the resource: delete and create, losing data.
  • DeletionPolicy: Retain alone does not stop replacement during an update; pair it with UpdateReplacePolicy.
  • ROLLBACK_COMPLETE cannot be updated: delete the stack and create it again. UPDATE_ROLLBACK_FAILED needs the cause fixed, then continue-update-rollback.
  • Drift detection does not alert. You must schedule it, and it ignores properties missing from the template.
  • StackSets run from the administrator account; deleting an instance can delete its resources unless retained.
  • A passing plan or cdk diff is not approval. Read replace (-/+) lines.
  • Suppressions are risk acceptances: name the exact rule ID, the reason and an owner.
  • A skipped test proves nothing: fail the build when Node.js is missing.
  • Terraform state holds secrets: encrypt it and restrict who can read it.
  • A policy scan is not compliance. Never claim a control equals compliance.

Cost traps

TrapAvoid it by
NAT Gateway in a lab VPCUse VPC endpoints, or keep it design-only
Interface endpoints left runningThey bill hourly; deploy, verify and destroy within the hour
Fargate, ALB and RDS left upThe lab environment costs about $0.20 per hour; destroy and check
Retained KMS key and bucketsSchedule the key for deletion (7-day minimum) and empty the buckets
Orphaned state bucketRemove it last, after every stack that uses it
Control Tower landing zoneDesign-only here; the services it enables bill

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page