Review, enforce and reconcile infrastructure definitions
Design repeatable infrastructure changes, protect secrets and roll out policy and infrastructure across account boundaries.
Task 5.1 · Review, enforce and reconcile infrastructure definitions
A StackSet change proposes 90 replacements
A CDK refactor changes a logical resource identity for a stateful service. A build test passes. One target is also manually patched and a secret is unexpectedly present in the generated template. Decide whether the release is ready.
Compare your design with the worked answer
Pause promotion. Inspect synthesized change sets, replacement and retention behavior, and reconcile the approved source of truth with the manual change. Replace embedded secrets with appropriate references. Use pre-provisioning checks, a canary account and constrained StackSet concurrency; validate each actual stack instance and the application before expansion.
A passing synthesis confirms that a template can be produced. It does not establish which live resource will be replaced or what access a newly deployed role will gain.
5.1.1 · Review the desired state before applying it
CloudFormation declares the target resource graph. CDK lets authors use a programming language to synthesize that graph. Inspect the synthesized template and a change set for replacements, ordering and deletion policies. An imperative custom resource needs idempotent create, update and delete behavior under retry. Store templates and parameters under version control.
5.1.2 · Place policy checks before and after deployment
Run policy checks on generated artifacts during CI. CloudFormation Hooks can block noncompliant supported provisioning actions in their scope. SCPs restrict allowed API use, while Config can detect state changed after deployment. For drift remediation, identify the source of truth, known exceptions and a bounded approval path before modifying resources.
5.1.3 · Keep secret material out of source and output
Pass a secret reference or identifier, limit retrieval to the runtime principal and avoid outputting plaintext in stack outputs, build logs and asset bundles. Use supported dynamic references where suitable. Rotation requires consumers to refresh, and a changed secret value alone does not necessarily update an already-provisioned resource.
5.1.4 · Roll out common infrastructure in rings
Use StackSets with appropriate delegated administration or execution roles to span accounts and Regions. Roll out a small canary OU/Region, cap concurrency and failure tolerance, and observe individual stack instances before broad deployment. Plan treatment of resources when an account leaves a target OU. Validate quota and regional differences.
Apply the video example
The CloudFormation chapter reviews a change set before execution. Read the proposed replacement as a recovery decision: if the old database disappears, where is the validated data copy and how does a rollback find it?
freeCodeCamp · 53:46:45 in AWS CloudFormation
Review, enforce and reconcile infrastructure definitions quiz
Answer 5 questions. Check each answer for an explanation.