Multi-Account AWS Platform Foundation
Six-account AWS platform with hub-and-spoke networking, EKS and ECS compute, and a Terraform/Terragrunt monorepo with 69+ reusable modules and PR-driven delivery.
Overview
This is in-house platform work: a six-account AWS estate that product teams deploy onto. It runs production EKS, ECS Fargate, and hybrid ECS Anywhere workloads. The whole estate is managed from one Terraform/Terragrunt monorepo, and every change goes through a pull request.
At a glance:
- 6 AWS accounts under AWS Organizations, separated by function and environment
- 69+ reusable Terraform modules and 90+ merged PRs setting the platform’s standards
- Hub-and-spoke networking through Transit Gateway with a centralized Network Firewall
- PR-driven delivery: plan posted as a PR comment, staged approvals, production guardrails
Account structure
The accounts split along two lines: what they’re for, and which environment they serve.
- A management account for billing, organization policy, and identity
- A security account for centralized logging and findings
- A shared networking account that owns the Transit Gateway, the firewall, and shared DNS
- Separate dev, nonprod, and prod workload accounts
Service Control Policies set the guardrails at the organization level. IAM Identity Center handles human access, so nobody shares long-lived credentials.
Networking
Every workload VPC attaches to a central Transit Gateway. Traffic between accounts and out to the internet passes through a centralized Network Firewall. A mesh of VPC peering would have been cheaper per GB, but the hub keeps routing and inspection in one place. I also designed an egress pattern that cut inter-account and NAT data-transfer spend. Multi-region Transit Gateway peering has been evaluated as part of the disaster-recovery posture.
Infrastructure as code and delivery
One monorepo holds the whole platform. Terragrunt keeps backend and provider configuration out of the individual stacks, and environment separation is part of the directory layout.
Delivery runs in GitHub Actions:
- Path-based change detection plans only the stacks a PR touches
- Plan as a PR comment, so reviewers see the real diff before approving
- Staged approvals, with nonprod applied first and production behind an explicit gate
- Guardrails on production and on high-risk operations
Platform decisions are written down as ADRs and reference architectures, so the next engineer knows why something exists, not just that it does.
Operations
- Observability with CloudWatch, Grafana, and Prometheus
- Python and Bash automation for Organizations audits, Identity Center sync, and IAM bootstrap
- Cost visibility by account, service, and Terraform pattern, backed by tagging and budget controls
- Guardrails for AI-assisted infrastructure work: human approval for high-risk changes, and no unattended apply or destroy
What I’d tell a team starting this
- Start in a monorepo. One place to plan and review beats coordinating upgrades across many repos.
- Put the plan in the PR. Reviewers approve what will actually change, not what they think will change.
- Build cost visibility early. Teams can’t optimize spend they can’t see.
- Write the ADR when you make the decision, not six months later when someone asks.
Technical notes
GitHub Actions to AWS with OIDC
CI assumes a role through GitHub’s OIDC provider, scoped to the repository and branch, so there are no stored access keys:
condition {
test = "StringEquals"
variable = "token.actions.githubusercontent.com:sub"
values = ["repo:example-org/infrastructure:ref:refs/heads/main"]
}
Terragrunt root configuration
remote_state {
backend = "s3"
config = {
bucket = "terraform-state-${get_aws_account_id()}"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "terraform-locks"
}
}
Each stack inherits this, so a stack file holds only what’s specific to that stack.
Working through a multi-account AWS foundation, or trying to get Terraform delivery to the point where the plan in the PR is the thing people trust? Get in touch to compare notes.
Technologies: AWS Organizations | Transit Gateway | Network Firewall | EKS | ECS | Terraform | Terragrunt | GitHub Actions
Working on a similar infrastructure decision?
I'm happy to compare notes on the approach and the trade-offs.