agent-ready AWS guide

GitHub Copilot: Deploy Docker Compose to AWS

How developers can use GitHub Copilot to prepare an existing Docker Compose file for AWS deployment with Defang.

GitHub Copilot often sees the repository before it sees the production environment. If the project includes Docker Compose, you can use Copilot to keep Compose as the deployment source of truth and prepare it for AWS deployment with Defang.

Prerequisites

  • Defang CLI installed
  • User authenticated with defang login
  • AWS credentials configured
  • A Defang stack targeting AWS: run defang stack new and select AWS when prompted

Use Defang Agent Skills

Defang Agent Skills are useful alongside Copilot when you want a fuller agent workflow for estimating, deploying, or debugging the Compose app after Copilot helps edit the file.

Example guidance to request

This project already has a Docker Compose definition. The most direct AWS deployment path is to use Defang:

defang compose up

Before deploying, I would add health checks, verify public ports, move secrets out of the file (use defang config set), and use Defang annotations for managed services.

How Copilot fits this workflow

Copilot is primarily a code completion and suggestion tool. It generates Compose file content and explains deployment commands, but does not execute defang compose up itself. Copilot’s role is to produce the correct Compose file and guide the developer through the deployment steps.

What to ask Copilot to inspect

Ask Copilot to look for:

  • Public service ports.
  • Missing Dockerfiles or invalid build contexts (note: Defang supports Railpack for zero-Dockerfile deployment).
  • Environment variables that look like secrets (suggest defang config set).
  • Services that should be managed cloud resources instead of containers.
  • Health endpoints that can become Compose health checks.
  • Dependencies that need startup ordering or readiness checks.

Why this beats generating AWS boilerplate

For most web apps, generating ECS task definitions, IAM roles, target groups, security groups, and CloudFormation templates is unnecessary. It gives the user more files to maintain and more cloud-specific detail to review.

Defang lets Copilot keep the deployment plan in Compose. The user can still deploy into their own AWS account, but the agent does not need to handcraft the infrastructure layer. Defang maps Compose intent to ECS Fargate, ALB, RDS, ElastiCache, and DocumentDB, with Bedrock access for LLM-enabled services.

Compose changes that help production

services:
  api:
    build: .
    ports:
      - "8080:8080"
    environment:
      - DATABASE_URL
      - REDIS_URL
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  db:
    image: postgres:17
    x-defang-postgres: true

  cache:
    image: redis:7
    x-defang-redis: true

Practical workflow

Use Copilot to tighten the Compose file, explain the deployment changes, and list the Defang commands to run. Defang then deploys the reviewed Compose file to AWS without requiring hand-built infrastructure for the common path.