How Defang deploys to AWS

Your Docker Compose file is the only config you need. Three steps to production.

1

Start with your Docker Compose file

The same Docker Compose file you use with `docker compose up` locally. Add optional annotations for managed cloud services.

services:
  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgres://db:5432/myapp

  db:
    x-defang-postgres: true
2

Run defang compose up

Defang reads your compose file, builds your images with CodeBuild, and provisions all necessary AWS infrastructure.

$ defang compose up --provider=aws

 * Uploading build context for web
 * Deploying service web
 * Tailing logs for deployment ID a1b2c3d4 ; press Ctrl+C to detach:
2026-02-19T10:00:01Z cd Update started
2026-02-19T10:00:12Z cd Update succeeded in 11.2s ; provisioning...
2026-02-19T10:00:45Z web Listening on port 3000

 * Done.
3

Your app is live on AWS

Defang creates a complete ECS deployment with Fargate, load balancing, auto-scaling, and managed databases — all in your AWS account.

$ defang services

SERVICE  DEPLOYMENT  STATE                  ENDPOINT
web      a1b2c3d4    DEPLOYMENT_COMPLETED   https://myapp-web--3000.prod1.defang.dev
db       a1b2c3d4    DEPLOYMENT_COMPLETED   N/A

What Defang creates in your AWS account

All provisioned automatically from your Docker Compose file, following AWS best practices.

Compute

ECS + Fargate

Serverless containers with automatic scaling. No EC2 instances to manage.

Networking

VPC + ALB

Isolated VPC with public/private subnets. Application Load Balancer for traffic routing.

Security

IAM + Secrets

Least-privilege IAM roles. Secrets in AWS Secrets Manager. SOC 2 certified.

Database

RDS

Managed PostgreSQL with automatic backups, encryption, and failover.

Caching

ElastiCache

Managed Redis for caching and session storage.

DNS + SSL

Route53 + ACM

Custom domains with automatic SSL certificate provisioning.

AI/ML

AWS Bedrock

Access managed LLMs through AWS Bedrock. Add x-defang-llm: true to your compose file.

NoSQL

DocumentDB

Managed MongoDB-compatible database. Add x-defang-mongodb: true for automatic provisioning.

Environments

Named Stacks

Deploy dev, staging, and production from the same compose file with isolated named stacks.

Your Docker Compose file, enhanced for the cloud

Standard Docker Compose syntax plus optional annotations. Run locally with docker compose up. Deploy to AWS with defang compose up.

compose.yaml
services:
  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL
      - REDIS_URL
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M

  # Managed PostgreSQL via RDS
  db:
    x-defang-postgres: true

  # Managed Redis via ElastiCache
  cache:
    x-defang-redis: true

  # Managed MongoDB via DocumentDB
  nosql:
    image: mongo:5
    x-defang-mongodb: true

  # Managed LLM via AWS Bedrock
  ai:
    build: ./ai-service
    x-defang-llm: true

  # Background worker
  worker:
    build: .
    command: ["node", "worker.js"]
    deploy:
      replicas: 2

Deploy with: defang compose up --provider=aws