On 28 November 2026 we moved KilatBot's transactional email from Resend to Amazon SES in the Jakarta region. Sign-in links, receipts, invitations and notices now go out through SES. This is why we moved, what we built, and how we kept the move easy to undo.
Why we moved
We started on Resend. Its free tier caps sending at 100 emails a day. Our mail is account mail: the message a person waits for after they ask for a sign-in link. A busy day with a few new workspaces could reach that cap. That is the worst place to hit a limit.
Amazon SES had two things we needed. First, a much higher ceiling. A new SES account starts in a sandbox that only sends to verified addresses. We asked for production access, it was approved, and the quota is now 50,000 emails a day. Second, a price that stays small as we grow. SES costs about US$0.10 per 1,000 emails.
The rest of our infrastructure already runs in one AWS account in Jakarta. Keeping mail there means one set of access rules and one place to manage it.
What we built
A Terraform module manages the setup, so it is written down and repeatable. It creates four things.
- A domain identity for kilat.host, with DKIM. DKIM signs each message, so a receiving server can check that it really came from us and was not changed on the way.
- A custom MAIL FROM subdomain, mail.kilat.host. It makes the SPF check line up with the address people see in the From line. Mail that passes both checks is less likely to be treated as spam.
- A configuration set. It publishes bounce, complaint and delivery events to an SNS topic.
- An IAM send policy. It lets the app send only from addresses at @kilat.host. If the app's credentials ever leaked, they could not send as any other domain.
Bounces and complaints
Sending to addresses that bounce, or to people who mark us as spam, harms the sending reputation of the whole domain. So we listen for those events.
SNS posts each event to a signed webhook in the Rails app. The app first checks the SNS signature, and only accepts messages from our own topic. Then it reads the event. When an address has a permanent bounce or a complaint, the app adds it to a suppression list and never sends to it again. Other events, such as delivery, are only logged.
One switch, one line to roll back
The app reads one environment variable, MAIL_PROVIDER. It has two values: ses or resend. The default is resend. In production we set it to ses.
If SES misbehaves, we change that one line back to resend and deploy. We kept the Resend path working on purpose, so rolling back never means writing new code in a hurry.
Moving the identity without deleting it
We had first created the SES identity for our test environment. It lives in that environment's Terraform state. Production needed to own it. If we had only added it to production, Terraform would have tried to create something that already exists. If we had only removed it from the test setup, Terraform would have destroyed it.
So we did it in two steps, in the same change:
- In production, an
importblock tells Terraform that the identity already exists and now belongs to the production state. - In the test setup, a
removedblock withlifecycle { destroy = false }tells Terraform to forget the identity without destroying it.
Nothing was deleted.
How we checked
We sent a test delivery and confirmed it end to end, from the app to the inbox. We only call this done after seeing that, not after the plan applied cleanly.
What we would tell another small team
- Ask for SES production access early. In the sandbox you can only send to addresses you have verified.
- Do not cut over without a way back. One variable and a working second provider cost us very little.
- Handle bounces and complaints on day one. Verify the signature before you trust the event.
- When state has to move between Terraform environments, use
importandremovedwithdestroy = false. Read the plan before you apply it.
KilatBot is where you set up an AI agent for your business tasks. See what an agent does, or the pricing.