Deploy to AWS
Deploy Runlane with Postgres, SQS, Lambda, and a container worker.
Deploy one Runlane app to Amazon Web Services (AWS). Trigger a greeting on Lambda and a report on Fargate. Then check both results from your laptop.
Use a disposable AWS account or project for this tutorial. The resources cost money until you remove them. The database is public so your laptop and Lambda can reach it. Use test data only, and harden the deployment before real use.
What you build
Amazon RDS hosts Postgres and keeps Runlane's durable state. Amazon Simple Queue Service (SQS) holds wakeup messages. Lambda runs code when an event arrives. Fargate runs containers without servers for you to manage.
laptop CLI ──trigger──> Postgres (RDS) ──outbox──> SQS default ──> Lambda delivery
└────────> SQS long-running ──> Fargate worker
EventBridge Scheduler (every minute) ──> Lambda maintenance
Deploying machine ──CLI migrations──> Postgres (before workloads change)
Both work queues ──after 5 receives──> SQS dead-letter queueAn outbox stores a pending wakeup with the run in Postgres. A publisher sends that wakeup to SQS. The consumer checks Postgres before it claims the run.
An event source mapping connects the default queue to Lambda. It polls SQS and invokes the delivery function. EventBridge Scheduler is an AWS timer service. It invokes the maintenance function every minute. Maintenance publishes due work. It also recovers runs that stopped partway through. A dead-letter queue (DLQ) holds messages after repeated delivery failures. See Lambda with SQS and SQS dead-letter queues.
Choose a consumer for each task
| Consumer | Use it for | Tutorial task |
|---|---|---|
| Lambda | Short work that fits the function timeout. | greeting.create on default. |
| Fargate | Long work or a process that stays running. | report.build on long-running. |
The delivery function has a one-minute timeout. Reports can wait up to ten minutes, so they use the container worker. The worker receives only its own queue. See Lambda quotas for the platform's timeout limits.
Understand the tutorial network
A virtual private cloud (VPC) is your AWS network. A subnet is a range of addresses within it. Use public subnets in two zones, called Availability Zones. Each zone is a separate location within one region. A security group is a set of network access rules.
The RDS security group allows TCP port 5432 from 0.0.0.0/0. This permits connection attempts from any IPv4 address. A password and verified TLS still protect the connection. TLS encrypts traffic and checks the server's identity. This broad network rule is for the exercise only.
Lambda runs outside your VPC and has no fixed outbound IP for this rule. The worker runs in a public subnet with a public IP. It can reach SQS and download its image without a NAT gateway. A NAT gateway gives private workloads outbound internet access. See RDS access rules and Fargate outbound access.
The database has no deletion protection, and teardown skips its final snapshot. Removing the stack deletes the tutorial data. A private database needs an in-VPC path for workloads, migrations, and CLI checks. The production checklist gives that path.
Pick a deploy tool
All three tools deploy the same app and AWS resources. Follow one tool page:
- SST: define the resources in TypeScript with SST.
- AWS CDK: define CloudFormation stacks in TypeScript.
- Terraform: define the resources in Terraform files.
CloudFormation is AWS's service for managing resource stacks. Each tool builds the worker image and runs database migrations before starting new workloads.
What you need
- An AWS account and credentials that can create the resources on your chosen tool page.
- Node.js 24 and npm.
- Docker running on your laptop to build the worker image.
- The AWS CLI, with credentials configured.
- A region that supports the listed services. Examples use
us-east-1; use the same region throughout.
The deploy tool creates IAM roles, identities whose policies grant AWS permissions. The functions and worker use those roles rather than saved access keys. Your laptop needs its own AWS credentials.
What AWS bills
Check pricing for your region before deploying. This tutorial does not estimate a total.
| Resource | What to review |
|---|---|
| RDS for PostgreSQL | Instance hours, storage, and backups. |
| Fargate | CPU and memory while the worker runs. |
| Lambda | Invocations and compute time. |
| SQS | Requests, including worker polls. |
| EventBridge Scheduler | Scheduled invocations. |
| Elastic Container Registry (ECR) | Storage and transfer for container images. ECR is AWS's image registry. |
| CloudWatch | Log ingestion and storage. CloudWatch holds function and worker logs. |
| Secrets Manager | Secret storage and API requests, when your deploy tool stores the database password there. |
| VPC and data transfer | Public IPv4 addresses and traffic. |
| Your deploy tool's storage | State, deploy assets, and any tool service fees. |
The tutorial has no NAT gateway. Private networking can add NAT or endpoint charges. A VPC endpoint gives private access to an AWS service.
Follow these steps
- Prepare the app. Build the shared code and bundles.
- Deploy with SST, CDK, or Terraform.
- Check the deployment. Prove delivery, maintenance, and stored results.
- Prepare for production, or remove the resources with your tool page's teardown command.
Keep the default Lambda recursive loop policy and the maintenance timer enabled.