Runbook: standing up a new account#

Four phases, all run from GitHub Actions. The only console work is creating a temporary IAM user for phase 0, which that phase then deletes. Works for any AWS account, in an Organization or not. See ADR-0014.

PhaseWhatWhereTime
0. SeedOIDC provider, state bucket, bootstrap roleseed-account workflow, with a temporary user~10 min
1. BootstrapCI roles and permissions boundarybootstrap-account workflow~2 min
2. InfrastructureThe stack, then the websiteterraform-apply workflow~10 min
3. Go-liveNameservers, DS record, alert emailRegistrar and inboxDNS propagation

Each phase can be re-run on its own, and later phases never need the earlier ones' access.

Before you start#

  • A new AWS account and a way to sign in to it with administrator access (the

root user with MFA, or OrganizationAccountAccessRole if it is in an Organization).

  • Admin on this GitHub repository (variables, secrets, environments).
  • Access to the registrar holding testz.dev.
  • The workflows on the default branch: GitHub only offers "Run workflow" for

workflows that exist on main. Run every one from main: they refuse any other branch, and the roles they assume trust only main (ADR-0019).

Phase 0: seed (once per account)#

Full steps, including the policy to paste: terraform/seed/README.md. In short:

  1. In the new account's IAM console, create user testz-seed-temp with the

inline policy terraform/seed/seed-user-policy.json (account ID and an expiry a few hours ahead filled in, as a full UTC timestamp like 2026-11-25T18:00:00Z), and an access key.

  1. In GitHub (Settings → Secrets and variables → Actions):
KindNameValue
Repository secretAWS_ACCOUNT_IDthe account's 12-digit ID
Environmentbootstrapcreate it; no reviewers while on GitHub Free; deployment branches: main only, where the plan offers it
bootstrap secretSEED_AWS_ACCESS_KEY_IDthe key ID
bootstrap secretSEED_AWS_SECRET_ACCESS_KEYthe secret
  1. Actions → seed-account → Run workflow, apply unticked; read the plan.

Then again with apply ticked. The run seeds the account, deletes the temporary user over the new OIDC role, and proves the key is dead.

  1. Delete the two SEED_* secrets.

AWS_ACCOUNT_ID is the only value copied out of AWS. The workflows derive every role ARN, the state bucket and the boundary ARN from it. It is a secret rather than a variable only so that GitHub masks it in logs; it is not a credential.

Prefer no key at all? The same seed runs from a laptop with an AWS CLI profile (terraform/seed/README.md, option B).

Phase 1: bootstrap the CI roles#

Actions → bootstrap-account → Run workflow:

  1. Apply unticked. Read the plan in the run summary: three testz-gha-*

roles with their policies and one boundary policy, all to be created.

  1. Run again with apply ticked. The run summary lists what phase 2 needs.

Re-running later is safe and is how changes to terraform/bootstrap reach the account.

Phase 2: infrastructure#

GitHub configuration, once:

KindNameValue
SecretALERT_EMAILwhere alarm and budget notifications go
Environmentprodadd yourself as a required reviewer, when the plan allows; deployment branches: main only, where the plan offers it
Environmentprod-deployno reviewers; deployment branches: main only, where the plan offers it

The prod environment is not optional. The apply role's trust policy only accepts an OIDC subject of repo:<owner>@<owner_id>/<repo>@<repo_id>:environment:prod, and GitHub will not mint such a token until a reviewer approves. Without the environment, no apply can ever authenticate — which is the intended design, not a bug. bootstrap works the same way for the seed's role. All three roles also require the token's ref to be refs/heads/main, so a run from any other branch is refused even when it names the environment.

While the repository is private on GitHub Free, the Required reviewers option is not available. Create the environments anyway, without reviewers: the jobs still authenticate, but nothing pauses them for approval, which is why bootstrap-account and terraform-apply are manual-only (Actions → Run workflow). See ADR-0006, "Current status".

Then Actions → terraform-apply → Run workflow. It plans, applies the saved plan, then deploys the website.

Expect 8–12 minutes, dominated by ACM validation and CloudFront creation. ACM can only validate once the domain is delegated, so on a brand-new zone the first run may time out at the certificate: do the nameserver step of phase 3 while it runs, and re-run once delegation has propagated.

The check blocks will emit warnings on this first apply — the distribution has not propagated and the bucket has no content. That is expected and is why checks warn rather than fail.

The terraform-apply run summary lists the four nameservers and the DS record on every run, so phase 3 needs no AWS credentials.

Phase 3: go-live#

Delegate the domain at the registrar#

Set the four nameservers from the apply run summary as the delegation at your registrar. Do this before the DS record, and wait for it to propagate:

dig +short NS testz.dev @1.1.1.1

Until this returns the Route 53 nameservers, nothing else works.

Publish the DS record#

Only after delegation has propagated. The record is in the apply run summary; the DS record runbook covers entering it.

Confirm the SNS subscription#

Check the inbox for ALERT_EMAIL and click the confirmation link.

This is easy to skip and fails silently. Terraform reports the subscription as created while it is still PendingConfirmation, so unconfirmed alarms look perfectly healthy in state and deliver nothing.

To verify delivery end to end, run Actions → alarm-delivery-test → Run workflow from main. It forces a guardrail alarm (the certificate-expiry alarm by default) into ALARM and then back to OK, and fails if CloudWatch reports that it could not publish to the topic. Two emails should arrive within a couple of minutes, ALARM then OK. A green run with no email means the subscription is still unconfirmed. The dnssec-probe-end-to-end option tests the hourly DNSSEC probe instead, by making it fail for real (probe runbook). The workflow needs the bootstrap layer's GuardrailAlarmDeliveryTest permission, so run it after phase 1 has been applied. If the real metric is breaching, the alarm returns to ALARM at its next evaluation.

Verify#

make health

Or by hand:

dig +dnssec A testz.dev @1.1.1.1 | grep -E 'flags:|RRSIG'
dig HTTPS testz.dev @1.1.1.1 +short
dig CAA testz.dev @1.1.1.1 +short
dig MX testz.dev @1.1.1.1 +short             # expect "0 ."
curl -sI https://testz.dev | grep -iE 'strict-transport|content-security'
curl -s https://testz.dev/api/whoami | head -20

# This MUST fail — the edge is TLS 1.3 only.
curl -sI --tls-max 1.2 https://testz.dev || echo "correctly refused TLS 1.2"

After go-live#

Content changes deploy on push to main (site-deploy). Infrastructure changes go through a pull request (plan) and then terraform-apply. To build the site locally: make site-serve (http://localhost:8000).

Common problems#

SymptomCause
Any workflow: … applies main only, and this run is on refs/heads/…Dispatched from another branch. Choose main under "Use workflow from".
bootstrap-account: Not authorized to perform sts:AssumeRoleWithWebIdentityThe bootstrap environment is missing, AWS_ACCOUNT_ID is not the account the seed is in, the seed's github_repository differs from this repository's name, or the token's ref is not main. Changing a trust policy: the trust runbook.
seed-account: The key belongs to account …The temporary user was created in a different account than AWS_ACCOUNT_ID.
seed-account: Could not assume role with OIDC right after seedingIAM had not propagated the new role yet and the retries ran out. Re-run with apply ticked: the seed converges and the cleanup runs again.
seed-account: cannot use its own policy, or explicit deny on CreateBucketThe policy's ExpiresAt statement is in force: EXPIRES_AT has passed, is a bare date (midnight UTC at the start of the day), or is still a placeholder. Use a full future timestamp such as 2026-11-25T18:00:00Z, then re-run.
seed.sh (laptop): AWS account ID not allowedThe profile points at a different account than the one you passed. The provider refuses before changing anything.
bootstrap-account: AWS account ID not allowedAWS_ACCOUNT_ID and the seeded account disagree. Fix the secret.
bootstrap-account: EntityAlreadyExists on a testz-gha-* rolePhase 1 resources already exist outside this state (an earlier manual bootstrap). Delete them or import them, then re-run.
AccessDenied writing state or acquiring the lockencrypt = true was added back to a backend block. It makes Terraform request AES256, which the state bucket policy rejects; leave it unset.
Error: creating ACM certificate: ... us-east-1Applying in the wrong region. The precondition should catch this first.
ACM validation times outNameserver delegation has not propagated. The zone must be authoritative before ACM can validate.
AccessDenied creating an IAM roleThe boundary ARN derived from AWS_ACCOUNT_ID does not exist: phase 1 has not run, or AWS_ACCOUNT_ID is wrong.
Could not assume role with OIDCThe prod environment does not exist, or the job is missing environment: prod, or the run is not on main, or the repository in the trust policy does not match.
Site returns 403No content deployed yet, or the bucket policy has not settled.
DNSSEC alarms in INSUFFICIENT_DATAExpected. Those metrics are only published once the condition first occurs — see the guardrails module README.

Built 2026-11-25 from commit 33bfabf6a27d4baeecf228c31bd5d636a3965070. This page was generated from the same source that provisions the infrastructure it describes.