Reusable modules, nested stacks, and StackSets
Exam alignment: Domain 2 tasks covering reusable infrastructure, automated account/resource onboarding, and configuration management.
Learning objective
Design, implement, and troubleshoot component interfaces, composition, multi-account distribution, rollout controls in a repeatable, secure, and operationally scalable way.
Professional scenario
A growing organization has many teams, AWS accounts, and Regions. Manual provisioning and configuration have created drift, inconsistent controls, unclear ownership, and slow onboarding. The platform team must standardize the environment without becoming a manual bottleneck.
Core concepts
- Define a clear desired state and version it.
- Separate control-plane permissions from execution permissions.
- Prefer managed, organization-aware capabilities over large custom scripts when they satisfy the requirement.
- Test at small scope before broad rollout.
- Make failure tolerance, concurrency, rollback, and exception handling explicit.
- Record evidence so configuration and governance decisions are auditable.
Architecture walkthrough
- Define the standard and its owner.
- Package the standard as infrastructure code, configuration, policy, or approved product.
- Validate syntax, behavior, permissions, and replacement risk.
- Deploy to a sandbox or small organizational unit.
- Observe events, compliance, and operational metrics.
- Expand in controlled waves.
- Detect drift and process exceptions.
- Version and improve the standard.
Decision guide
| Requirement | Preferred direction | Why |
|---|---|---|
| Reusable infrastructure | Versioned component with a stable interface | Reduces duplication |
| Multi-account deployment | Organization-aware managed deployment | Central control at scale |
| Large fleet operation | Rate controls and staged waves | Limits blast radius |
| Temporary exception | Owner, reason, approval, and expiry | Prevents permanent hidden drift |
| Sensitive execution | Scoped role and protected configuration | Enforces least privilege |
Failure modes and troubleshooting
- A permission is allowed by IAM but denied by an SCP, resource policy, KMS key policy, or permissions boundary.
- A broad rollout exceeds concurrency or failure-tolerance settings.
- A component changes without versioning and breaks consumers.
- A retained or imported resource has no clear cleanup owner.
- Drift is detected, but the team cannot determine whether the template or the live setting is approved.
- An automatic remediation repeats a destructive action.
Security and operations
- Use scoped deployment and automation roles.
- Protect parameters, secrets, logs, templates, and account metadata.
- Audit changes to policies, baselines, products, and controls.
- Do not store secrets directly in templates or source.
- Test backup, recovery, and cleanup for stateful resources.
Hands-on lab
Goal: Create a controlled design or small implementation for Reusable modules, nested stacks, and StackSets.
Tasks
- Write functional, security, and operational requirements.
- Draw the control plane, target accounts or nodes, and execution roles.
- Build a minimal template, construct, document, rule, or policy.
- Introduce one controlled failure.
- Diagnose it from service events and logs.
- Define staged rollout and rollback.
- Document cost and cleanup.
Validation
- The workflow is repeatable and idempotent.
- The result can be audited.
- Failure is contained by scope, concurrency, or tolerance settings.
- No secret is exposed.
- Cleanup ownership is explicit.
Cost control: Prefer design simulation for organization-wide services. Keep deployments small and remove all test resources.
Cleanup
- Delete test stacks, rules, associations, products, documents, and roles.
- Remove retained resources only after checking dependencies.
- Delete temporary logs and artifacts according to policy.
Exam traps
- Confusing a guardrail with a permission grant.
- Choosing a custom Lambda workflow when StackSets, Systems Manager, Config, or Control Tower already provides the required capability.
- Assuming that drift should always be overwritten immediately.
- Rolling out to every account at once.
- Ignoring replacement, retention, or cleanup behavior.
Key takeaways
- Configuration management is continuous, not a one-time deployment.
- Reusable standards require stable interfaces, ownership, and versioning.
- Organization-scale automation requires controlled failure behavior.
- Governance combines preventive, detective, and corrective mechanisms.
Review questions
- What is the desired state in this lesson?
- Which service or component owns execution?
- Which permission layers can affect the action?
- How is rollout limited?
- How is drift detected?
- How are exceptions governed?
- What is the rollback or recovery path?
- Which evidence proves success?
Answers
- The approved versioned configuration.
- The scoped managed-service role or automation workflow.
- IAM, resource policies, SCPs, permissions boundaries, and KMS where applicable.
- By OUs, Regions, waves, concurrency, and failure tolerance.
- Through CloudFormation, AWS Config, Control Tower, or operational-state comparison.
- With owner, reason, approval, scope, and expiry.
- Revert the managed change, restore state, or return to the previous version.
- Events, compliance results, outputs, logs, and change history.