GebSecure Docs v0.1.0

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:

  1. 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.
  2. Wait and reapply for the production account. Approval is uncertain and has no timeline.
  3. 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.tf creates, in 168021617887, the gebsecure.com identity (Easy DKIM 2048-bit, MAIL FROM mail.gebsecure.com) and the IAM user gebsecure-prod-ses-smtp (ses:SendRawEmail on that identity only, ses:FromAddress *@gebsecure.com). It publishes the identity's DKIM records in the gebsecure.com zone. 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 (bootstrap persistent_smtp_environments). It survives production teardowns. envs/prod lists smtp in persistent_secrets and sets ses_enabled = false, so it creates no SMTP user of its own. The Helm values are unchanged (same secret name).
  • The gebsecure.com identity in the production account stays as it is. If AWS later grants that account production access, switch back by removing ses-relay.tf and persistent_smtp_environments, and setting ses_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/prod needs credentials for both accounts (gebsecure-prod-tf and the sender_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.tf is deleted. Its resources (the gebsecure.com identity and the gebsecure-prod-ses-smtp user in 168021617887, and that identity's DKIM records) were destroyed first with -target, while the aws.sender provider was still configured.
  • envs/prod sets ses_enabled = true: its own SMTP user in 389049474831 (modules/edge), sending as *@gebsecure.com through the identity bootstrap already keeps there (verified, DKIM and MAIL FROM SUCCESS).
  • gebsecure/prod/smtp stays a persistent secret (bootstrap persistent_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.