Going through Week 8, we looked at seven tools: CloudFormation's Nested/Cross-Stack, Service-managed StackSets, the Custom Resource ResponseURL protocol, Hooks' pre-deployment validation, the CDK's Construct Levels and Pipelines self-mutation, and Terraform tfstate locking. The hard questions on the exam do not feature these tools separately. Three or four of them are tangled together in one scenario, and the question asks "where, and with which tool, should this be solved?" Today we build that integrated sense.
Before solving the questions, let's organize once more. IaC tools are distinguished along three axes: abstraction layer, governance scope, and change timing. Abstraction rises from CFN (YAML) → SAM (macro) → CDK (code); governance expands from a single stack → multiple stacks in a single account → multi-account (StackSets/Pipelines); and change timing has four stages: synthesis time (Aspects/cdk-nag) → before deployment (Hooks) → during deployment (ChangeSet) → after deployment (Drift/Config). Exam scenarios ask where on these three axes the answer lies.
The foundation engine, 13 years of accumulated governance assets
SAM
CFN macro + serverless DSL
Stack
Synthesis → deployment
Condenses serverless boilerplate
CDK
Code (TS/Py/Java)
Stack
Synthesis → deployment
The LLVM IR pattern, code reusability
CDK Pipelines
Code
Multi-environment
Self-mutating CI
The pipeline is code too, the GitOps principle
StackSets
CFN synchronization
Multi-account, multi-Region
OU-level fan-out
The single source of truth for 1000+ accounts
Custom Resource
Lambda Provider
Extension inside a stack
Invoked during deployment
Extends CFN as a lifecycle engine
CFN Hooks
Resource Type Provider
Stack or Org
Pre-blocks changes
The K8s ValidatingAdmissionWebhook pattern
CFN Drift
Detection mechanism
Stack/StackSet
Post-deployment comparison
Detection only, no automatic fix
Change Set
Change preview
Stack
Review before deployment
Replacement=True is the danger signal
Terraform
HCL
Per tfstate
plan → apply
Multi-cloud, self-managed tfstate
CDKTF
Code → HCL
tfstate
Synthesis
CDK constructs + Terraform Providers
Keep this table in mind as you look at the scenarios. Each scenario is built to resemble a real operational situation a company has faced, and the options other than the correct answer are partly correct as well, so you must pick "the most appropriate."
📝 Practice Questions
Click a choice to reveal the answer and explanation.
Question 1
A fintech wants to deploy the same GuardDuty/CloudTrail/Config baseline to 200 child accounts in an AWS Organizations environment, and the same baseline must be applied automatically to new accounts added every week. The security team also requires minimizing day-to-day use of the Management Account. What is the most appropriate configuration?
Question 2
A SaaS company deployed an RDS DBInstance change to a prod CloudFormation Stack, and the database was unintentionally replaced, causing 6 hours of downtime. To strengthen the standard change procedure so the same incident does not recur, what is the most appropriate combination?
Question 3
In a CloudFormation environment run by a game company, the network Stack's VpcId Export is used as an ImportValue by 50 other Stacks. When they tried to update the network Stack to expand the VPC, the entire deployment stopped with a "Cannot update Export" error. Which answer satisfies both an immediate fix and long-term improvement?
Question 4
A company wants to codify a newly released AWS Bedrock model in CloudFormation but found that some deep features are not yet supported by CFN. They plan to handle only that part with a Custom Resource Lambda. What is the most important design element for operational stability?
Question 5
A SaaS deploys the same pattern (Lambda + DynamoDB + API Gateway + X-Ray + CloudWatch Alarm) to 200 microservices with the CDK. The security team wants to apply a new policy ("all Lambdas must have reserved concurrency of 100 or less, and all DynamoDB tables must have point-in-time recovery enabled"). How can you enforce it consistently without modifying the code of the 200 services?
Question 6
A game company deploys to three environments, Dev/Staging/Prod, with CDK Pipelines, but after adding the Prod account the build fails with a "KMS access denied" error. The Pipeline is in the Tooling account and Prod is a separate account. What is the most accurate cause and fix?
Question 7
A SaaS introduced CDK Aspects and applied 30 cdk-nag rules to prod all at once, including forcing encryption on all S3 buckets, multi-AZ on all RDS, a dead letter queue on all Lambdas, and WAF association on all ALBs. The build failed with 1200 violations and all deployments stopped. What is an appropriate adoption strategy?
Question 8
A fintech removed 5 child AWS accounts from Organizations because of a subsidiary sale, and the baseline Stacks deployed by StackSets were automatically deleted, so the CloudTrail Trail inside them disappeared and 90 days of audit logs from just before the sale were lost. What is the most accurate combination to prevent recurrence?
Question 9
A company adds a new environment (5 per-customer sandboxes) every week, and each time an operator edits the CodePipeline definition by hand and redeploys the pipeline with CFN. What is the most appropriate tool to automate this?
Question 10
In a 500-account environment, the security team requires evaluating in real time which accounts have GuardDuty disabled and automatically re-enabling it. What is the most appropriate multi-layered configuration?
Question 11
A company injected an RDS password into a prod CloudFormation Stack with '{{resolve:secretsmanager:prod/db:SecretString:password}}'. After the security team rotated the password in Secrets Manager, they found it was not applied to RDS and was reflected only at the next Stack update. To synchronize automatically, what should be done?
Question 12
A company wants to set an IaC operating standard that satisfies all of the following requirements: (1) a human confirmation step on every prod change, (2) blocking unintended RDS replacement, (3) automatic baseline for new member accounts, (4) pre-blocking of security policy violations in prod CFN changes, (5) quickly codifying newly released AWS services, (6) consistently enforcing the common pattern across 200 microservices. What is the most appropriate tool mapping for each requirement?
Today's integrated scenarios are the settlement of all of Week 8's learning. To summarize, there are five principles.
First, choose the abstraction layer appropriately. CFN (low-level) → SAM (serverless macro) → CDK (code) each have their pros and cons, and the higher abstraction is not automatically the answer. For prod security policy, precise control with CDK L1 or direct CFN is recommended, and for repeated standard patterns, concentrating them in your own L3 Construct is the standard.
Second, expand governance scope step by step. Start from a single Stack and expand to multiple Stacks in one account (Cross-Stack/Nested), multi-account (StackSets), multi-account multi-environment (CDK Pipelines), and the Org level (Conformance Pack/Hooks). Adopt in stages to fit the company's size.
Third, multi-layered validation across change timing. All four stages, synthesis time (Aspects/cdk-nag/cfn-lint), pre-deployment (Change Set + Manual Approval, Hooks), and post-deployment (Drift Detection, Config Rules), prevent different incidents. A single layer has bypass paths.
Fourth, multi-layered protection of stateful resources. DeletionPolicy (on Stack deletion), UpdateReplacePolicy (on replacement from property changes), Stack Policy (on entering the Update API), Termination Protection (on DeleteStack API calls), and even separate backups (AWS Backup), a five-layer defense. A single policy can always be bypassed.
Fifth, graceful rollout of governance tools. Phased adoption of Hooks WARN→FAIL, cdk-nag warning→error, Config Rule notify→remediate, and OPA dryrun→warn→deny is the standard. Enforcing all policies at once causes operational paralysis.
Next week we move into the area of configuration management: SSM Parameter Store, AppConfig, Secrets Manager, EC2 Image Builder, Patch Manager. If IaC defined the "shape of the infrastructure," configuration management handles "the values that infrastructure needs to operate." As Week 8's dynamic reference {{resolve:ssm:...}} meets Week 9's Parameter Store operating principles, the same mechanism is revealed in greater depth.
Week 8 complete. From CloudFormation's 13 years of accumulated governance assets to CDK Pipelines self-mutation, we have passed once through the whole realm of modern IaC operations. In your final check before the exam, if you re-solve this article's 12 scenarios again, where you are weak will become clear.