AWS
Deploy the engine in your AWS account with one template: Lambda behind CloudFront at your address, a new RDS Postgres or yours, and SES.
The template deploy/aws.yaml builds the reference implementation in your account, for one project at your address.
What it creates
- The engine. The engine on Lambda (arm64) with a function URL. It installs or upgrades the schema when it starts.
- The events function. A second function for the minute tick (e-mail retries, cleanup), SES bounces and complaints, and admin actions.
- CloudFront at your address with your certificate. A secret header, kept in Secrets Manager, makes sure nobody skips it to call the function URL directly.
- Optionally, a Lambda@Edge function that puts back the
WWW-Authenticateheader, which Lambda function URLs rename; MCP clients need it.
- Optionally, a Lambda@Edge function that puts back the
- Postgres. Either a new RDS PostgreSQL 16 (
DatabaseMode=create) or yours (DatabaseMode=existing).- A new instance gets a generated password in Secrets Manager. It is publicly reachable with TLS required: the functions run outside a VPC, so narrow
DbAllowedCidrwhen you can. - It takes a final snapshot when the stack is deleted.
- A new instance gets a generated password in Secrets Manager. It is publicly reachable with TLS required: the functions run outside a VPC, so narrow
- SES. A configuration set wired to bounce handling, and, if you name a domain, its identity with DKIM records.
- DNS. Route 53 records for your address, when you give the zone.
Prepare
- The engine’s Lambda package in an S3 bucket of the same region. Download
sypnia-data-lambda-arm64.zipfrom the release, or build it withcargo lambda build --release --arm64 -p sypnia-data-server --output-format zip.Terminal aws s3 cp sypnia-data-lambda-arm64.zip s3://my-bucket/sypnia-data/0.1.0/sypnia-data-lambda-arm64.zip - A master key in SSM Parameter Store, generated in place and never pasted anywhere:
Terminal aws ssm put-parameter --name /sypnia-data/master-key --type SecureString --value "$(openssl rand -base64 32)" - A certificate in
us-east-1(ACM) that covers your address, e.g.api.myapp.com. - With your own Postgres, its connection string as an SSM SecureString. It must be a user that can install (create roles and a schema):
Terminal aws ssm put-parameter --name /sypnia-data/database-url --type SecureString --value 'postgres://…?sslmode=require'
Deploy
aws cloudformation deploy --stack-name my-data --template-file deploy/aws.yaml --capabilities CAPABILITY_IAM \
--parameter-overrides CodeBucket=my-bucket CodeKey=sypnia-data/0.1.0/sypnia-data-lambda-arm64.zip \
DomainName=api.myapp.com CertificateArn=arn:aws:acm:us-east-1:…:certificate/… HostedZoneId=Z0123… \
DatabaseMode=create MailProvider=ses MailFrom='My app <no-reply@myapp.com>' MailDomain=myapp.com| Parameter | Default | What |
|---|---|---|
CodeBucket, CodeKey | —, sypnia-data/0.1.0/sypnia-data-lambda-arm64.zip | where the Lambda package is |
MasterKeyParameter | /sypnia-data/master-key | the SSM SecureString with the master key |
DomainName, CertificateArn | — | your address and its us-east-1 certificate |
HostedZoneId | empty | your Route 53 zone: alias record and DKIM records |
DatabaseMode | create | create (new RDS) or existing (DatabaseUrlParameter) |
DatabaseUrlParameter | /sypnia-data/database-url | with existing: the SSM SecureString with the connection string |
DbInstanceClass, DbAllocatedStorage, DbAllowedCidr | db.t4g.micro, 20, 0.0.0.0/0 | with create |
MailProvider | ses | ses, smtp, resend, postmark, none |
MailFrom, MailDomain | empty | the sender; with SES, the domain to verify |
MailSecretParameter | empty | with smtp/resend/postmark: an SSM SecureString with the SMTP URL, API key or token |
ReservedConcurrency, PoolMax | 5, 4 | at most this many instances, each with this many connections |
RestoreWwwAuthenticate | true | the Lambda@Edge function; deleting a stack that has it waits for CloudFront to remove its replicas (up to a few hours) |
Without HostedZoneId, point your address at the output DistributionDomainName yourself. A new SES account starts in the sandbox: ask AWS for production access before sending to anyone.
Keys and a first check
The first request installs the schema. Then create the project’s keys with the events function (outputs EventsFunction):
aws lambda invoke --function-name my-data-events --cli-binary-format raw-in-base64-out \
--payload '{"action":"api_key","ref":"default","kind":"publishable"}' /dev/stdout
curl https://api.myapp.com/healthUse "kind":"secret" for a secret key, and save its output somewhere safe; it is shown once. The MCP server is at https://api.myapp.com/mcp.
Upgrading and deleting
- Upgrading. Upload the new package under a new key and deploy again with that
CodeKey. The next cold start installs the new migrations, which are additive (upgrades). - Deleting. Deleting the stack keeps a final snapshot of a created database. Delete that snapshot yourself when you no longer need it.