Infrastructure and environments playbook
Rules for the infrastructure a service runs on. Code, environments, access, secrets, networks, servers, containers, cost and hosting, each with a check.
- Required 30
- Recommended 53
- Optional 3
An infrastructure playbook for anyone who sets up or changes the machines, networks and accounts a service runs on. It works the same on AWS, Google Cloud, Azure, a smaller host or one rented server. It is written for the developer or the AI agent who makes the change, and for the owner who has to trust it.
Most cloud breaches and surprise bills start with one hand-made change. Somebody opened a port, kept an old key or forgot a test server. These rules put every change in code, check it before it ships, and keep each environment and key apart.
Start with Infrastructure as code. Every other chapter assumes that changes go through code, review and CI. Then read Identity and access, because a leaked key does more harm than any other single mistake. If you run one server, read Servers next. If you still have to choose where the service runs, start with Hosting platforms.
Running containers, on one host or on Kubernetes, is in Containers and orchestration. Running the service lives in the operations playbook, including monitoring, backups, recovery and building container images. Building and deploying the app lives in the engineering playbook. Attacks and their fixes live in the adversarial testing playbook.
Chapters
Infrastructure as code
Create every resource from code in version control. Keep state locked and encrypted, review each plan, apply only from CI and catch drift daily.
- Required 3
- Recommended 6
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
Identity and access
Sign people in through one identity provider, give every role the least it needs, and keep no long-lived keys. Log every call in a trail nobody can change.
- Required 7
- Recommended 4
Configuration and secrets
Keep settings in code and secrets in a store. Keep secrets out of state, let CI and services sign in with short-lived identity, and rotate on a timer.
- Required 1
- Recommended 4
Networking and DNS
Keep databases private, open only the ports you name, limit outbound traffic and force TLS. Keep DNS in code and put a firewall at the edge.
- Required 6
- Recommended 6
Policy as code
Scan infrastructure code on every change, test your own rules against the plan, block dangerous actions at the organization level, and let exceptions expire.
- Recommended 5
Servers
Replace servers instead of changing them by hand. Rebuild any server from code, install security updates by themselves, and close every port you do not use.
- Required 2
- Recommended 7
Cost and ownership
Tag every resource with its owner and give every account a budget with alerts. Delete what sits idle, size servers from use and show cost per request.
- Required 1
- Recommended 4
- Optional 3
Hosting platforms
Choose where the service runs from written needs and test each platform limit. Keep data, keys, domain, quotas and a way out in your own hands.
- Required 3
- Recommended 7
Containers and orchestration
Run containers without root, read-only and on private networks. On Kubernetes, set probes, resource requests, disruption budgets and pod security.
- Required 7
- Recommended 5
This is a lot to check. An Expert can check it for you.
Related playbooks
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">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.