Architecture · All ADRs
ADR 0019 — Production email through the account that has SES production access
Architecture decision record — status: Superseded (2026-10-13): production sends from its own account again; see Update..
Status: Superseded (2026-10-13): production sends from its own account again; see Update.
Context#
The app sends email over SMTP (SMTP_URL). Each environment's modules/edge created an SMTP-only IAM user in
the environment's own account and wrote its URL to gebsecure/<env>/smtp.
Amazon SES starts every account in the sandbox (verified recipients only, 200 messages a day). We requested production access for both accounts:
- 168021617887 (management account, staging): granted on 2026-10-08, case 179098884200919 (50,000 messages a day, 14 per second).
- 389049474831 (production): denied on 2026-10-09, case 179142893200958, with no reason given. Granted on 2026-10-12 after the case was reopened (50,000 messages a day, 14 per second); see Update below.
Production therefore could not email users who aren't verified recipients: sign-up verification, password resets, MFA codes and approval requests would all fail.
Options considered:
- Another provider (Resend, Postmark, Brevo, …) behind the same
SMTP_URL. Works, but adds a vendor, its DNS records and its own account review, while the rest of the platform is on AWS. - Wait and reapply for the production account. Approval is uncertain and has no timeline.
- Send production mail through 168021617887's SES. Same provider and the same DKIM/SPF/DMARC setup;
production keeps its own SMTP user, scoped to
*@gebsecure.com.
Decision#
- Option 3.
infra/terraform/bootstrap/accounts/prod/ses-relay.tfcreates, in 168021617887, thegebsecure.comidentity (Easy DKIM 2048-bit, MAIL FROMmail.gebsecure.com) and the IAM usergebsecure-prod-ses-smtp(ses:SendRawEmailon that identity only,ses:FromAddress*@gebsecure.com). It publishes the identity's DKIM records in thegebsecure.comzone. The MAIL FROM MX/SPF records the production account already publishes are the same for every account in the region. - The SMTP URL goes to a persistent secret,
gebsecure/prod/smtp(bootstrappersistent_smtp_environments). It survives production teardowns.envs/prodlistssmtpinpersistent_secretsand setsses_enabled = false, so it creates no SMTP user of its own. The Helm values are unchanged (same secret name). - The
gebsecure.comidentity in the production account stays as it is. If AWS later grants that account production access, switch back by removingses-relay.tfandpersistent_smtp_environments, and settingses_enabled = true.
Consequences#
- Production email depends on 168021617887. Only permanent resources are involved (bootstrap), never the staging environment, so tearing staging down does not affect production mail.
- Staging and production share one SES account's sending reputation and quota. Both send the same kind of mail
(transactional, from GebSecure to its users). Bounce and complaint rates are account-wide. Permanent alarms in the sender account
(
bootstrap/ses-reputation.tf,ses_reputation_alarm_email) email the operators at 2% bounces or 0.05% complaints, before AWS's review levels (about 5% and 0.1%). - Applying
bootstrap/accounts/prodneeds credentials for both accounts (gebsecure-prod-tfand thesender_profile,gebsecure-tf). - The SMTP password is derived from the IAM access key and is in that bootstrap's local state, like the
environment SMTP users before it. Rotate with
terraform apply -replace=aws_iam_access_key.prod_smtp.
Update (2026-10-13)#
aws sesv2 get-account shows production access in both accounts (389049474831 and 168021617887: 50,000 a day,
14 per second, HEALTHY). The relay stays in place for now. Switching production back to its own SES (see
Decision) is now possible and would give it a sending reputation separate from staging's.
The relay was always a stopgap, so it is removed:
bootstrap/accounts/prod/ses-relay.tfis deleted. Its resources (thegebsecure.comidentity and thegebsecure-prod-ses-smtpuser in 168021617887, and that identity's DKIM records) were destroyed first with-target, while theaws.senderprovider was still configured.envs/prodsetsses_enabled = true: its own SMTP user in 389049474831 (modules/edge), sending as*@gebsecure.comthrough the identity bootstrap already keeps there (verified, DKIM and MAIL FROMSUCCESS).gebsecure/prod/smtpstays a persistent secret (bootstrappersistent_smtp_environments) so its name is reusable at once after a teardown; the environment writes its SMTP URL into it.- The production account has its own permanent reputation alarms (
ses_reputation_alarm_email); staging and production no longer share a sending reputation or quota.