I used to build infrastructure by clicking through the console. It worked — until the Friday I needed to recreate a stack in a second Region and realized nobody, including me, remembered exactly which buttons had been clicked. That was my last console-built environment. CloudFormation turned my infrastructure into versioned code, but the tool alone didn't fix my deploys. These six habits did.
1. One stack per real boundary, not per service
A stack should map to something you deploy, roll back, and delete as a unit — one application, one environment, one shared-networking layer. The moment a stack holds two things with different lifecycles, every change becomes a negotiation. I split mine at the point where I'd ever want to delete one half and keep the other.
2. Always preview with a change set
I never hit Update directly. A change set shows me exactly which resources will be replaced, which get interrupted, and which properties change — before anything happens. The one time I skipped it, a "harmless" property edit replaced a database. Change sets take thirty seconds and have saved me more than once.
3. Run drift detection on a schedule
Console clicks still happen — someone tweaks a security group rule in an emergency and forgets to tell anyone. I run drift detection weekly on my long-lived stacks and treat any drift as a bug: either the template gets updated to match reality, or the resource gets restored to match the template. Untracked drift is how "the template is the truth" quietly stops being true.
4. Parameters and mappings, never hardcoded values
Environment names, instance sizes, and AMI IDs live in parameters or mappings, never baked into resource definitions. The same template deploys to dev and production because the only thing that changes is the parameter file. It also means a code review can actually review the change — the diff is three lines, not three hundred.
5. Export sparingly; prefer SSM Parameter Store
Stack outputs and exports feel convenient until you try to delete the stack that exports a value another stack imports. I keep exports to genuinely stable shared values — VPC IDs, hosted zone IDs — and pass everything else through SSM Parameter Store, which decouples the stacks and lets me delete without untangling a dependency graph.
6. Let rollback do its job, and protect what matters
I leave rollback-on-failure enabled and turn on termination protection for production stacks. A failed deploy that rolls itself back is a five-minute story; a failed deploy that half-applies is a weekend. And deletion protection exists for the exact moment someone runs the wrong command at 1 a.m. — I have been that person.
Key takeaways
- Treat the template as the only source of truth, and drift as a bug to fix, not a fact to accept.
- Preview every change with a change set; never update blind.
- Design stacks around deletion boundaries, and export only what is truly stable.
- Rollback and termination protection are cheap insurance — enable them before you need them.
Loading article