AWS Copilot

A CLI that generates infrastructure and deploys containerized apps to ECS for you.

AWS Copilot is a command-line tool that hides the low-level ECS wiring. From a Dockerfile it creates the ECR repo, cluster, task definition, service, load balancer, and pipelines using sensible defaults.

When to use it

  • You want production-ready ECS without writing all the JSON and IaC by hand.
  • You prefer a guided, opinionated workflow.

Under the hood Copilot generates CloudFormation, so you can still inspect and extend everything.

Example

Example · bash
# From a directory with a Dockerfile
copilot init \
  --app store \
  --name web \
  --type 'Load Balanced Web Service' \
  --dockerfile ./Dockerfile

# Deploy to an environment
copilot deploy --env prod

When to use it

  • A startup uses AWS Copilot to deploy their first ECS service without writing any CloudFormation or Terraform, going from code to running service in minutes.
  • A developer runs 'copilot deploy' from their laptop to push a new image and update the ECS service, with Copilot handling ECR push and task definition registration.
  • A team uses Copilot environments to create isolated dev and prod ECS clusters with separate VPCs, each deployed with a single command.

More examples

Initialize a Copilot Application

Sets up a new Copilot application with a production environment and a load-balanced ECS service backed by an ALB, all from three CLI commands.

Example · bash
copilot app init my-app
copilot env init --name prod --profile default --default-config
copilot svc init --name api --svc-type 'Load Balanced Web Service' --dockerfile ./Dockerfile

Deploy Service with Copilot

Builds and pushes the Docker image to ECR, registers a new task definition revision, and updates the ECS service — all in one command.

Example · bash
copilot svc deploy \
  --name api \
  --env prod

View Copilot Service Logs

Streams live CloudWatch logs from all running tasks of the ECS service, similar to tailing a log file but aggregated across all task replicas.

Example · bash
copilot svc logs \
  --name api \
  --env prod \
  --follow

Discussion

  • Be the first to comment on this lesson.