Blueprints · Blueprint 01

Serverless contact pipeline

How this site takes a message from a visitor to our inbox, logs it, and tells us if that ever stops working.

  1. Formbrowser
  2. API GatewayHTTPS endpoint
  3. Lambdavalidate
  4. DynamoDBsave first
  5. SESemail us

↳ a failed email never loses the message, because it is saved first

This is the architecture behind the contact form on this site. We use it as our own first case study: it is small, it is real, and it is the same pattern we build for clients who need a form that works.

The problem

A contact form has one job, and it fails quietly. A message gets lost, or the notification lands in spam, and nobody finds out until a customer asks why nobody replied. The design below is built around never losing a message and never failing silently.

How it works

  1. The browser posts the form to /api/contact, served through CloudFront.
  2. API Gateway passes the request to a Lambda function.
  3. The function checks the input and ignores any submission where the hidden honeypot field is filled in.
  4. It saves the submission to DynamoDB first.
  5. It then sends a plain-text email through SES, with the visitor’s address as the reply-to.
  6. It returns a short success response, and the page shows the “FILED” stamp.

Decision log

Decision Why
Save to DynamoDB before sending email If email fails, the message still exists and can be recovered.
Plain-text email only No markup from visitors ends up rendered in our inbox.
Honeypot field only, WAF left out The honeypot costs nothing. WAF CAPTCHA adds a monthly fee and can be added later if spam shows up.
No third-party form service The data stays in our AWS account and the pieces are ones we already run.
Return success if the email fails but the save worked The visitor did nothing wrong. We get the alarm, not them.

Keeping watch

  • A CloudWatch alarm fires if the function logs an error or an email fails.
  • A Synthetics canary loads the home page and posts a flagged test message to the form API every 15 minutes, so a broken path is found by us, not by a customer.
  • Alarms notify us through SNS.

Things to do before launch

  • Move SES out of sandbox mode, and set up SPF, DKIM and DMARC for the domain.
  • Back up the DynamoDB table.
  • Confirm the address that receives the notification.
Sheet 06 · Start here

Got a messy cloud? Let's draw it out.

Tell us what's broken or what you're planning. We reply within 48 hours.

no sales script, just a drawing

What do you need?

We reply within 48 hours.

FILED

Thanks. Your note is on the sheet and we will be in touch.