Wedding Website

a password-protected wedding site built with angular, lambda@edge and aws cdk

This is a password-protected wedding website made of three prerendered Angular apps served from one private S3 bucket through CloudFront. A Lambda@Edge function checks every request for a valid guest token before anything is served. A small API on API Gateway and Lambda handles login, after-party access and RSVPs, and AWS CDK defines all of it. This blog post covers how it was built.

Check out the demo site for an “anonymized” version of the original site and the GitHub repo for more detailed information and extended documentation about the site.

Tech Stack

Layer Technology
Front ends Angular 21 (static output, every route prerendered), TypeScript 5.9, RxJS
UI libraries ngx-toastr, google-libphonenumber (E.164 phone validation)
Hosting Amazon S3 (private, OAC), CloudFront, ACM, Route 53
Edge auth Lambda@Edge (viewer request), Node 24
API API Gateway REST API on a custom api. domain, Lambda (Node 24, bundled with esbuild)
Data DynamoDB (on-demand): auth tokens with TTL, RSVPs
Secrets AWS Secrets Manager
Protection AWS WAF (geo-block plus AWS managed rule sets), API Gateway throttling
Infrastructure AWS CDK v2 in TypeScript, four stacks
Tests Jest 30 with ts-jest and a mocked AWS SDK (Lambdas); Karma and Jasmine (apps)

Architecture

Components

Wedding site architecture A guest's browser reaches CloudFront through AWS WAF, which only admits traffic from the US and Canada. CloudFront has three behaviours, for the login app at /, the main site at /w/* and the after-party site at /s/*, all served from one private S3 bucket through Origin Access Control. A Lambda@Edge function runs on every viewer request and looks the guest's token up in the DynamoDB auth table. Separately, the browser calls API Gateway on api.domain/v1. A login Lambda handles POST /auth and POST /secret, reading both passwords from Secrets Manager and writing tokens to the auth table. An RSVP Lambda handles PUT /rsvp, reading the auth table and writing to the RSVP table. Route 53 holds aliases for the apex and api subdomain, and one ACM certificate covers the apex and a wildcard. Route 53 apex + api. aliases ACM certificate apex + wildcard Guest’s browser AWS WAF US + Canada only CloudFront / · /w/* · /s/* 3 behaviours Lambda@Edge viewer request S3 bucket (private, OAC) login/ ← / wed/w/ ← /w/* wed/s/ ← /s/* GetItem API Gateway api.<domain>/v1 Login Lambda POST /auth · POST /secret RSVP Lambda PUT /rsvp Secrets Manager both passwords DynamoDB wedding-auth-table · TTL DynamoDB RSVP table Four CDK stacks, all in us-east-1, deployed in order: Route53 → Secret → Api → CloudFront.

Login sequence

Login sequence The login app posts the password to API Gateway at api.domain/v1/auth, which is throttled to 5 requests per second. API Gateway invokes the login Lambda, which reads both passwords from Secrets Manager on its first call and caches them for the life of the container. If the password matches, the Lambda writes a random UUID to DynamoDB with a 60-day expiry and TTL, and returns 200 with an HttpOnly, Secure, SameSite=None api-token cookie scoped to the apex domain. The browser then goes to /w/. Browser API Gateway Login Lambda Secrets Manager DynamoDB POST /v1/auth · password throttled: 5 req/s, burst 10 invoke GetSecretValue first call only, then cached both passwords PutItem · random UUID expire in 60 days, TTL set 200 · Set-Cookie: api-token=<uuid> HttpOnly; Secure; SameSite=None; Domain=<apex> go to /w/
A wrong password gets a 401 and no cookie. The cookie is scoped to the apex, so the browser sends it to both api. and the site itself.

Request sequence

Request sequence for a protected page The browser requests a page under /w/ with its api-token cookie, through AWS WAF. CloudFront runs the Lambda@Edge function on the viewer request, before checking its cache. The function looks the token up in the DynamoDB auth table in us-east-1. If the token is valid, it rewrites the path to index.html and hands the request back to CloudFront, which serves it from the cache or, on a miss, from the private S3 bucket through Origin Access Control. A missing, unknown or expired token gets a 401. A request to /s/* without party approval gets a 302 to /w/secret, and a failed lookup gets a 500. Browser CloudFront Lambda@Edge DynamoDB S3 bucket GET /w/travel · Cookie: api-token through AWS WAF viewer request, before the cache GetItem uuid in us-east-1, from any edge item: expire, party valid · uri → /w/travel/index.html cache miss: GetObject, signed by OAC index.html page otherwise no cookie, unknown or expired → 401 /s/* without party approval → 302 /w/secret lookup fails → 500
Requests to the login app at / pass straight through. /w and /s without a trailing slash get a 301 before any check. The 401 is a JSON body, not a redirect to the login page.

After-party unlock

Deployment

Infrastructure (manual)

  1. One-time: bootstrap CDK in us-east-1 and create the secret by hand.
  2. Deploy: npm run deploy (tsc --noEmit && cdk deploy --all), which deploys Route53 → Secret → Api → CloudFront in order.

Site content (manual)

  1. ng build each app.
  2. aws s3 sync each build to its prefix.
  3. CloudFront invalidation of /*.
  4. Run the 7-step checklist in docs/deployment.md.

Estimated Cost

Item Estimate
AWS WAF web ACL + rules ~$15 / month + $0.60 per million requests
Secrets Manager (1 secret) ~$0.40 / month
Route 53 hosted zone ~$0.50 / month
API Gateway free for 12 months, then ~$3.50 per million calls
DynamoDB (on-demand) pennies at wedding traffic
Lambda@Edge free-ish tier
S3, CloudFront, ACM free-ish tier
Domain registration ~$20
Total ~$160

Highlights

Known Limitations

How it got built: blog →