Environments
Give each environment its own account, build them all from the same code, change staging before production, and delete preview copies on time.
- Recommended 5
An environment is one full copy of the service, such as development, staging or production. The rules here keep the copies alike, so a change that works in staging works in production. They also keep them apart, so a mistake in one cannot reach the others. Test data and the staging copy itself are covered in Keep a staging copy with fake data.
Recommended
Give each environment its own account
INF-10Run production in its own cloud account, project or subscription. Development, staging and previews each live in another one.
Build every environment from the same code
INF-11Build all environments from the same modules. Let them differ only in values such as sizes, counts and names, kept in one file per environment.
Change staging before production
INF-12Apply every infrastructure change to staging first. Apply the same commit to production only after the staging apply and its smoke tests pass.
Delete preview environments on time
INF-13Give each pull request its own short-lived environment from the same code. Delete it when the pull request closes, and after 72 hours at most.
Start every account from one baseline
INF-14Create every new account from code with the same baseline. That means an audit log, a budget, blocked public storage, default encryption and the allowed regions.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/environments">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.