AWS
AWS architecture
What runs in each stage's AWS account, how the pieces connect, and what differs between stages. Everything here is defined as code with SST, in infra/ and sst.config.ts.
Dashed: only on some stages. mock-firmware runs on dev and staging only. Dev has no VPC: its database is public, for test data only.
The building blocks
| Area | AWS services | What it does |
|---|---|---|
| Domains | Route 53 | One hosted zone per stage (for example connect-dev.nosaint.co), delegated from nosaint.co on Cloudflare. The web app gets the bare name, the admin admin.<domain>. |
| Web apps | CloudFront, Lambda, S3 | Both Next.js apps, packaged with OpenNext, each behind a Router on its domain. |
| Device connectivity | IoT Core | The MQTT endpoint, one thing and certificate per device, the shared device policy, device shadows, and the three topic rules. |
| Messaging | SQS | The ingest queue and its dead-letter queue (3 tries, kept 14 days). |
| Processing | Lambda, EventBridge schedules | ingest on the queue; owner-check daily at 07:00 Montréal; device-commander every minute; db-migrator on each deploy. |
| Database | RDS Postgres 17 | With PostGIS. db.t4g.micro, 20 GB. Private on staging and production (Multi-AZ on production). |
| Network | VPC, EC2 NAT, bastion | Staging and production: 2 availability zones, a small NAT instance per zone so Lambdas can still reach outside services, and a bastion for maintenance access to the database. |
| Non-production only | Lambda, IoT provisioning | mock-firmware answers for simulated devices; a provisioning template and virtual-device-provisioner let virtual devices register themselves. |
| These docs | S3, CloudFront | A static site at docs.connect-dev.nosaint.co, deployed by the dev stage only. |
The three stages
| Stage | Region | Domain | Database | State |
|---|---|---|---|---|
dev | ca-central-1 | connect-dev.nosaint.co | public, test data only | Live |
staging | us-east-1 | connect-staging.nosaint.co | private, in a VPC | Live |
production | us-east-1 | connect.nosaint.co | private, Multi-AZ | Not deployed |
- Each stage lives in its own AWS account, so a mistake on dev can’t touch production.
- Production keeps its data and is protected if the app is ever removed.
- AWS Device Location only answers in us-east-1, so dev calls it across regions.
How changes reach AWS
- Pull request: lint, typecheck, tests, a build of these docs, and a check that database changes come with their migration.
- Merge to main: dev and staging deploy automatically. An app that didn’t change is skipped.
- Production: by hand, for now.
- Database migrations run inside the deploy, through the db-migrator Lambda. A failing migration fails the deploy.