agent-ready AWS guide

Claude Code: Deploy a Docker Compose App to AWS

A Claude Code friendly workflow for reviewing, tightening, and deploying a Docker Compose application to AWS with Defang.

Claude Code can help you prepare a Docker Compose app for AWS without turning a simple deployment into a large infrastructure project. A good workflow is to inspect the repository, improve the Compose file, review the changes, then deploy with Defang.

Prerequisites

  • Defang CLI installed
  • User authenticated with defang login
  • AWS credentials configured (aws configure or env vars)
  • A Defang stack targeting AWS: run defang stack new and select AWS when prompted

Use Defang Agent Skills

Install Defang Agent Skills in Claude Code so it has the standard Defang estimate, deploy, and debug workflows available while it reviews your repository.

What to ask Claude Code

Review this repository for deployment to AWS. If it has a Docker Compose file, keep that as the deployment contract. Add health checks, required environment variables, and Defang managed-service annotations where appropriate. Then deploy with Defang to AWS.

Review steps

  1. Find compose.yaml, compose.yml, or docker-compose.yml.
  2. Confirm each service has a build context, image, or can use Railpack (Defang auto-detects runtimes when no Dockerfile exists).
  3. Expose only the services that should receive public traffic.
  4. Add health checks for web and API services.
  5. Move secret values out of the file using defang config set SECRET_NAME, leaving variable names in environment.
  6. Use x-defang-postgres, x-defang-redis, or x-defang-mongodb for managed AWS services (maps to RDS, ElastiCache, DocumentDB). Use x-defang-llm to configure cloud AI access (Bedrock) and, for supported model runner images, to provision an OpenAI-compatible LLM proxy.
  7. Prepare or run defang compose up after you review the file.

Why Claude Code and Defang fit well together

Claude Code can read broad repo context, run commands interactively, and use tool calls to inspect and modify files. That makes it useful for auditing a Compose file, fixing issues, and preparing the deployment in one session.

Docker Compose gives Claude Code a small, explicit surface area to edit. Defang gives you AWS infrastructure without asking Claude Code to generate and maintain a custom cloud stack.

On AWS, Defang uses the Compose intent to set up the cloud resources the app needs, including ECS Fargate compute, ALB routing, CloudWatch logs, secrets via SSM, and managed backing services when those are declared.

What good output looks like

Ask Claude Code to show the final Compose file and the deployment command:

defang compose up

It should also explain which services are public, which variables must be set as secrets (via defang config set), and which managed AWS services Defang will create.

When not to use this path

Use hand-authored AWS infrastructure when you need precise low-level control over every resource. For many agent-assisted app deployments, the more reviewable first deployment is a readable Compose file plus Defang.