Steadybase
Deployment

ECS Migration

Target ECS Fargate architecture for container-based deployment.

ECS Fargate Migration

The target deployment architecture migrates from EC2 to ECS Fargate — AWS's serverless container platform. This provides container isolation, auto-scaling, and eliminates server management.

Target Architecture

┌─────────────────────────────────────────────────────────────┐
│                        AWS VPC                              │
│                                                             │
│  ┌────────────────────────────────────────────────────────┐  │
│  │  Public Subnet                                        │  │
│  │  ┌─────────────────────────────────────────────────┐   │  │
│  │  │  Application Load Balancer (ALB)               │   │  │
│  │  │  - TLS termination (ACM certificate)           │   │  │
│  │  │  - Health checks                               │   │  │
│  │  │  - WAF integration                             │   │  │
│  │  └──────────────────────┬──────────────────────────┘   │  │
│  └─────────────────────────┼──────────────────────────────┘  │
│                            │                                 │
│  ┌─────────────────────────┼──────────────────────────────┐  │
│  │  Private Subnet         │                              │  │
│  │                         ▼                              │  │
│  │  ┌─────────────────────────────────────────────────┐   │  │
│  │  │  ECS Fargate Service                           │   │  │
│  │  │  ┌───────────────┐  ┌───────────────┐          │   │  │
│  │  │  │  Task 1       │  │  Task 2       │          │   │  │
│  │  │  │  (API Server) │  │  (API Server) │          │   │  │
│  │  │  └───────────────┘  └───────────────┘          │   │  │
│  │  └─────────────────────────────────────────────────┘   │  │
│  │                                                        │  │
│  │  ┌─────────────────────────────────────────────────┐   │  │
│  │  │  ECS Fargate Service                           │   │  │
│  │  │  ┌───────────────┐                             │   │  │
│  │  │  │  Task         │                             │   │  │
│  │  │  │  (Temporal    │                             │   │  │
│  │  │  │   Worker)     │                             │   │  │
│  │  │  └───────────────┘                             │   │  │
│  │  └─────────────────────────────────────────────────┘   │  │
│  │                                                        │  │
│  │  ┌────────────────────┐  ┌─────────────────────────┐   │  │
│  │  │  RDS PostgreSQL   │  │  ElastiCache Redis     │   │  │
│  │  │  (future)         │  │  (future)              │   │  │
│  │  └────────────────────┘  └─────────────────────────┘   │  │
│  └────────────────────────────────────────────────────────┘  │
│                                                             │
│  ┌────────────────────────────────────────────────────────┐  │
│  │  AWS Services                                         │  │
│  │  ┌──────────┐ ┌───────────┐ ┌────────────┐ ┌───────┐ │  │
│  │  │ Secrets  │ │CloudWatch │ │   ECR      │ │  IAM  │ │  │
│  │  │ Manager  │ │  Logs     │ │ (Images)   │ │ Roles │ │  │
│  │  └──────────┘ └───────────┘ └────────────┘ └───────┘ │  │
│  └────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

Benefits Over EC2

FeatureEC2 (Current)ECS Fargate (Target)
Server managementManual patches, SSH accessNo servers to manage
ScalingManual (resize instance)Auto-scaling based on load
IsolationShared process spaceContainer isolation per service
Secrets.env files on diskAWS Secrets Manager (runtime injection)
LoggingLocal filesCloudWatch (centralized, searchable)
DeploymentManual SSH + git pullCI/CD with rolling deployment
NetworkingPublic IP, open portsPrivate subnet, ALB only
CostAlways-on instancePay per task runtime

Migration Steps

Containerize the Application Create Dockerfiles for the API server and Temporal worker. Test locally with Docker Compose.

Set Up ECR Create an ECR repository for container images. Push images via CI/CD.

Configure ECS Create ECS cluster, task definitions, and services. Configure ALB with health checks.

Migrate Secrets Move all secrets from .env to AWS Secrets Manager. Update task definitions to reference secrets.

Set Up CI/CD GitHub Actions pipeline: build → test → push to ECR → deploy to ECS.

DNS Cutover Point durableminds.steadybase.io to the ALB. Verify, then decommission EC2.

CI/CD Pipeline (Planned)

# .github/workflows/deploy.yml
name: Deploy to ECS
on:
  push:
    branches: [main]
 
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build and push to ECR
        # Build Docker image, push to ECR
      - name: Deploy to ECS
        # Update ECS service with new task definition

Timeline

StepTarget
Dockerize applicationPhase 2, Week 1-2
ECR + ECS setupPhase 2, Week 2-3
Secrets Manager migrationPhase 2, Week 3-4
CI/CD pipelinePhase 2, Week 4-5
DNS cutover + EC2 decommissionPhase 2, Week 6

On this page