Architecture Options
This guide focuses on ECS Fargate. It provides the best balance of simplicity and production
readiness for BunShip deployments.
Prerequisites
- An AWS account
- The AWS CLI v2 installed and configured
- A Turso account for the database
- Docker installed locally (for building images)
ECS Fargate Deployment
1
Create an ECR repository
Amazon Elastic Container Registry stores your Docker images.
2
Build and push the image
3
Create an ECS cluster
4
Store secrets in AWS Secrets Manager
Store sensitive values separately from your task definition.
5
Create a task definition
Save this as Register the task definition:
ecs-task-definition.json:6
Create an Application Load Balancer
The ALB distributes traffic across your ECS tasks and terminates TLS.
7
Create the ECS service
8
Deploy the worker
Create a second task definition for the worker with a different command. The worker does not need a load balancer or port mappings.
ElastiCache for Redis
If you prefer AWS-managed Redis over Upstash or other providers:REDIS_URL secret to point to the ElastiCache endpoint:
S3 Bucket Configuration
Create a bucket for file uploads:For ECS tasks, use an IAM task role with S3 permissions instead of access keys. This avoids
storing long-lived credentials.
CloudFront CDN
Place CloudFront in front of your ALB for edge caching and DDoS protection:
For static assets served from S3, create a separate CloudFront behavior with caching enabled.
ALB Health Checks
The ALB health check confirms each ECS task is ready to serve traffic:
ECS also runs the container-level health check defined in the task definition. A task that fails either check is replaced automatically.
CI/CD with GitHub Actions
BunShip includes a release workflow (.github/workflows/release.yml) that builds and pushes Docker images when you create a version tag. Extend it with an ECS deployment step:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
For better security, use GitHub OIDC with
AWS
instead of long-lived access keys.
Scaling
ECS Auto Scaling
Configure target tracking to scale based on CPU utilization:Cost Estimates
Approximate monthly costs for a small production deployment in us-east-1:
Costs scale with traffic. Fargate Spot can reduce compute costs by up to 70% for fault-tolerant workloads like the worker.

