Environment strategy
Cloud environments exist to isolate blast radius and catch problems before customers do. The unit of isolation is not a namespace or a tag — it is a separate cloud account, project, or subscription with its own network and its own IAM.
Recommended default
Section titled “Recommended default”Run three long-lived environments — dev, staging, production — plus ephemeral preview environments per merge request. Each long-lived environment is a separate cloud account (AWS), project (GCP), or subscription (Azure). Add one shared services account for the artifact registry, DNS, and org-wide observability.
- Separate accounts per environment. No cross-env IAM by default. A compromised dev credential must not reach staging or production.
- Separate networks. One VPC per environment. No peered subnets across envs. Preview envs get their own VPC or a dedicated subnet inside dev.
- One primary region. Pick the region closest to your users. Add a second region only when RTO or RPO requirements force it — not to feel resilient.
- Cost tags on everything.
env,service,owner. Untagged spend is someone else’s problem until it isn’t. - Promotion by pipeline, not by human.
The same artifact moves dev → staging → prod. No manual
terraform applyagainst prod.
Why this is the default
Section titled “Why this is the default”Account boundaries are the only isolation the cloud provider actually enforces. IAM policies, network ACLs, and naming conventions all leak under pressure — a misconfigured role or a typo’d tag is enough. A separate account fails closed.
Three environments cover the three questions worth answering separately: does it run? (dev), does it run like prod? (staging), does it work for customers? (production). Preview environments carry per-change review load so staging stays clean for release candidates.
Common mistakes or tradeoffs
Section titled “Common mistakes or tradeoffs”- One account, multiple envs by tag or namespace. Cheap to set up, expensive the first time a blast-radius incident crosses the boundary.
- Staging in a different region or SKU than prod. Then staging stops catching the bugs it exists to catch. Match shape, not just name.
- Shared VPC across envs “for simplicity”. A misrouted security group now spans environments. Peer explicitly if you must; don’t share.
- Preview envs writing to shared data stores. A preview that touches the staging database is not ephemeral. Seed disposable data per preview.
- Prod credentials in dev pipelines. If a dev CI job can assume a prod role, prod isolation is theatre.
Step by step
Section titled “Step by step”- List every account, project, or subscription. Note env, owner, and last real use.
- Move any environment that shares an account with another into its own.
- Confirm staging matches prod in region, SKU, and network topology.
- Wire preview envs into the merge request pipeline with isolated data and auto-destroy on merge or close.
- Enforce cost tags at deploy time — reject infra that lands untagged.