Engineering reference: the compliance tracker architecture
Same system, drawn for engineers. Region, service names, resource identifiers, Bedrock model IDs, Lambda inventory, IAM scopes, the SES inbound rule set, EventBridge Scheduler config, the DynamoDB schemas, and the Slack interactive flow. Read alongside the previous six posts; this one’s the build sheet.
Region and account shape
Default region: ap-southeast-1 (Singapore). SES inbound, Bedrock cross-Region inference, and EventBridge Scheduler are all in good shape there. A second region for multi-region resilience isn’t worth the extra setup work at SMB volume — the failure mode for an SMB is somebody missing a recurring check, not a regional outage. One AWS account dedicated to the tracker (separate from your other workloads) keeps the IAM blast radius small and lets a single AWS Budgets alarm cover the whole system.
Topology
Lambda functions
All Lambdas use the arm64 architecture, the smallest memory size that meets latency targets (typically 256 MB), Python 3.14 runtime, and CloudWatch Logs at 7-day retention. Each function has its own least-privilege IAM role. None run inside a VPC.
drive-sync— EventBridge Scheduler target, fires every 15 minutes. Uses the Google Drive API + Sheets API (service-account credentials in Secrets Manager underct/drive/sa) to export the task sheet as CSV and write tos3://ct-tasklist-source/tasks.csvonly if the sheet has changed since the last sync. Same pattern syncs the rules and voice docs tos3://ct-rules-source/. Memory: 256 MB. Timeout: 30 s.starter-pack-loader— Function URL (admin-only, IAM-authenticated) invoked from a small internal admin page. Reads a chosen pack template froms3://ct-rules-source/packs/<pack>.jsonand appends its rows to the Drive task sheet via the Sheets API, pre-filling repeat rules, proof types, and a placeholder owner. Idempotent per pack (skips rows already present by name). Memory: 256 MB. Timeout: 30 s.intake-ses-parser— S3 PUT trigger ons3://ct-raw-mime/. Parses MIME, extracts the attachment, runs Textract viaStartDocumentTextDetection+StartDocumentAnalysis(asynchronously to handle multi-page policies). On Textract completion (via SNS notification), reads the structured text and calls Bedrock Haiku 4.5 (anthropic.claude-haiku-4-5-20251001-v1:0viaglobal.anthropic.claude-haiku-4-5-20251001-v1:0) to propose a task row (name, control area, repeat rule, proof type). Posts the proposal to Slack viachat.postMessagewith Approve/Edit/Discard buttons. For DOCX attachments (Textract doesn’t accept them), falls back topython-docx; XLSX usesopenpyxl. Both packages are stable and widely used in 2026, though their maintenance velocity is light — for a policy-parsing path that only runs a few times a month, that’s acceptable. If extraction precision becomes a concern, the active community forkpython-docx-ossis a drop-in alternative. Memory: 512 MB. Timeout: 60 s.scheduler— EventBridge Scheduler target, daily at 8am local time (the schedule expression runs inTZ_NAMEset to the SMB’s timezone, e.g.Asia/Singapore). Readss3://ct-tasklist-source/tasks.csvand the rules and voice docs. For each row, computesnext_due_datefrom the repeat rule and last-done date, reads cycle state fromct-remindersandct-done, decides on a move. Emits one event per row that needs action:ct.due_now,ct.overdue, orct.escalate, with the task context as the event payload. On-track tasks emit nothing. Memory: 512 MB. Timeout: 60 s. No Bedrock calls.dispatch— EventBridge rule on the three move events. Resolves owner, checks quiet hours and holiday calendar, formats the reminder from the voice template, and ships via Slackchat.postMessage(bot tokenct/slack/bot-tokenin Secrets Manager) or SESSendRawEmail. On quiet-hours or holiday defer, creates a one-off EventBridge Scheduler rule that re-invokesdispatchat the next available business minute. Writes a row toct-remindersafter a successful send. Memory: 256 MB. Timeout: 30 s.done-handler— Lambda Function URL, public withAuthType: NONE; verifies a Slack signature on the request body. Triggered by Slack interactive button clicks (Done/Attach/Snooze) and by email-link clicks. Writes toct-doneandct-audit; on done, updates the Drive sheet via the Sheets API and archives the old cycle inct-reminders-archive. On attach, stores the uploaded file ins3://ct-evidence/and calls Textract + Bedrock Haiku 4.5 for a one-line summary. Memory: 256 MB. Timeout: 15 s.digest— EventBridge Scheduler target, weekly Sunday 6pm. Readsct-remindersandct-donefor the past week and the task list; sends a digest message to a configured Slack channel summarizing tasks done and items coming up. No Bedrock; the message is a plain summary table. Memory: 256 MB.summary— EventBridge Scheduler target, monthly on the first Monday at 9am. Reads the past month’sct-reminders,ct-done, andct-audit; calls Bedrock Haiku 4.5 to write a one-paragraph board narrative; emails it via SES to the configured stakeholder list. Memory: 512 MB.
Storage
- DynamoDB ·
ct-reminders— one row per dispatch. PK(task_id, chain_index); attributes:reminded_date,dispatched_via(slack/email),recipient,move(due_now/overdue/escalate). On-demand. No TTL. - DynamoDB ·
ct-done— one row per completion. PKtask_id; sort keydone_date; attributes:action(done/attach/snooze),by_user,snooze_until(if action = snooze),cycle_due_date,next_due_date,evidence_key(if action = attach). On-demand. - DynamoDB ·
ct-audit— one row per write action of any kind. PK(task_id, ts); attributes:action,by_user,before,after. On-demand. No TTL — this is the long-term audit trail. - DynamoDB ·
ct-reminders-archive— archived cycles after a completion. Same shape asct-reminders; PK(task_id, cycle_id, chain_index). On-demand. - S3 ·
ct-tasklist-source— mirrored CSV from the Drive task sheet. Versioning enabled. Lifecycle to Glacier at 90 days; expiry at 7 years. - S3 ·
ct-rules-source— mirrored rules and voice docs as plain text, plus the starter-pack templates. Versioning enabled. - S3 ·
ct-raw-mime— raw inbound MIME from forwarded policies. Lifecycle to Glacier at 30 days; expiry at 7 years. - S3 ·
ct-evidence— uploaded proof files (photos, signed forms, PDFs), keyed by<task_id>/<cycle>/. Versioning enabled; this is the durable evidence store, kept for 7 years.
Bedrock
- Foundation model.
anthropic.claude-haiku-4-5-20251001-v1:0via the Global cross-Region inference profileglobal.anthropic.claude-haiku-4-5-20251001-v1:0. Two callsites:intake-ses-parserfor the forwarded-policy parsing anddone-handler/summaryfor the evidence summary and monthly board narrative. Claude Sonnet 4.6 (anthropic.claude-sonnet-4-6-20250930-v1:0) is wired but unused by default — reserved for the rare case where a forwarded policy is long and ambiguous enough that Haiku’s proposal needs a heavier second pass. - Embeddings. Not used. The task list is structured rows; deterministic lookup beats vector retrieval here. No Knowledge Base, no S3 Vectors.
- Quotas. Default account quotas are more than enough at SMB volume. The scheduler itself doesn’t call Bedrock; the parsing and evidence lanes fire a few times a month at most.
EventBridge Scheduler config
ct-daily-tick—cron(0 8 * * ? *)in the SMB’s timezone. Target:schedulerLambda.ct-drive-sync—rate(15 minutes). Target:drive-syncLambda.ct-weekly-digest—cron(0 18 ? * SUN *)in TZ. Target:digestLambda.ct-monthly-summary—cron(0 9 ? * 2#1 *)(first Monday at 9am) in TZ. Target:summaryLambda.- One-off rules — created on the fly by
dispatchwhen a quiet-hours or holiday defer is needed. Useat(YYYY-MM-DDTHH:MM:SS)expressions with--action-after-completion DELETEso the rule self-cleans.
SES inbound and outbound
- Set the MX record on a dedicated subdomain (e.g.
controls.your-company.com) toinbound-smtp.ap-southeast-1.amazonaws.com. - SES inbound rule set
ct-inbound-rules: one rule with recipientcontrols@your-company.com→ spam scan → S3 PUT tos3://ct-raw-mime/<message-id>→ stop. The S3 PUT triggersintake-ses-parser. - SES outbound for the email-fallback reminders: verify a sender identity at
tracker@your-company.comwith DKIM and SPF on the parent domain. Out of sandbox by request.
IAM (least privilege per Lambda)
Each Lambda has its own role with policies scoped to exact ARNs. Sketch:
- scheduler role:
s3:GetObjecton the task list, rules, and voice keys;dynamodb:Query+GetItemonct-reminders,ct-done;events:PutEventson the default bus. Nobedrock:*. - dispatch role:
scheduler:CreateSchedulefor the deferred-reminder one-offs;secretsmanager:GetSecretValueon the Slack bot-token secret;ses:SendRawEmailfrom the verified sender identity;dynamodb:PutItemonct-reminders; outbound network access toslack.com. - done-handler role:
dynamodb:PutItemonct-doneandct-audit;s3:PutObjectonct-evidence;textract:*+bedrock:InvokeModelfor the evidence summary;secretsmanager:GetSecretValueon the Sheets-API service-account secret; outbound network access tosheets.googleapis.com; on done,dynamodb:BatchWriteItemfor archiving the old cycle toct-reminders-archive. - intake-ses-parser role:
s3:GetObjectonct-raw-mime;textract:StartDocumentTextDetection+StartDocumentAnalysis;bedrock:InvokeModelon the Haiku ARN;secretsmanager:GetSecretValueon the Slack bot token. - drive-sync and starter-pack-loader roles:
secretsmanager:GetSecretValueon the Google service-account secret;s3:PutObjectands3:GetObjecton the task list and rules buckets; outbound network towww.googleapis.com.
Slack interactive flow
The reminder messages are posted via the chat.postMessage Web API with Block Kit blocks containing the action buttons. Button clicks are sent by Slack to the configured Interactivity request URL, which is the done-handler Function URL. done-handler verifies the Slack signing secret on the inbound request, parses the action_id (done, attach, snooze), opens a modal if needed (Attach and Snooze open modals; Done is one-tap), and processes the response when the modal is submitted. The Attach modal uses Slack’s files.upload flow so the proof file lands in S3 rather than only in Slack.
The Slack app needs chat:write, im:write, files:read, and the Interactivity URL configured. The bot token lives in Secrets Manager under ct/slack/bot-token. The signing secret is ct/slack/signing-secret.
Observability and cost gates
- CloudWatch Logs: all Lambdas, 7-day retention, structured JSON. Subscription filter on
"error"+"throttle"+"timeout"to a CloudWatch metric for alerting. - Alarms: scheduler Lambda failures > 0 in a day (the daily tick is the one piece that has to run); dispatch failure rate > 1% in 24h; done-handler signature-verification failures > 5/hour (might mean the Slack secret rotated).
- X-Ray: off by default. Not worth the cost at SMB volume.
- AWS Budgets: $15/month threshold, alarm at 80% and 100%, posts to SNS topic
ct-cost-alarmsubscribed to the on-call admin’s email and Slack.
Config and secrets
Service-account credentials for Drive, Sheets, and Calendar APIs all live in Secrets Manager under ct/drive/sa (one service account with scopes for all three APIs). Slack bot token and signing secret under ct/slack/*. SES sender identity lives in IAM and the verified-domain config. The configured timezone, holiday list reference, quiet-hours window, max_snoozes_per_cycle, and admin fallback owner all live in Parameter Store under /ct/config/. Lambdas fetch config on cold start and cache for the lifetime of the execution environment.
Deploy
GitHub Actions with OIDC into a deploy role (no long-lived keys), building with AWS SAM. The opinionated bits: deploy the SES rule set as a separate stack (rule-set changes affect mail flow), turn on S3 versioning for ct-tasklist-source, ct-rules-source, and ct-evidence so a bad Drive edit can be rolled back in one click and proof files are never silently overwritten, and version the EventBridge Scheduler timezone setting so you don’t accidentally start running the daily tick in UTC after a CI rotation. Total deployable surface: around eight Lambdas, four DDB tables, four S3 buckets, one EventBridge rule on the default bus (plus the Scheduler rules), one SES rule set, and one Budgets alarm.
That’s the full system. Six narrative posts and this engineering reference. If you want to talk about adapting it for your business, see Work with me.
All posts