AWS Copilot
The simplest way to deploy containers to AWS
šµ Cost Warning: Copilot creates real AWS resources that incur charges. A typical deployment costs $30-50/month: ALB (~$16/mo), Fargate (~$15/mo), NAT Gateway (~$32/mo if using private subnets). Use copilot svc pause to scale to zero when not needed, or copilot app delete to remove everything. See our Costs & Cleanup Guide.
What is AWS Copilot?
AWS Copilot is a CLI tool that simplifies deploying containerized applications to AWS. It abstracts away the complexity of ECS, VPC, ALB, and IAM configuration into simple commands and YAML manifests.
Best for Getting Started
Copilot Architecture
Application: "my-app"
āāā Environment: "staging"
ā āāā VPC with public/private subnets
ā āāā ECS Cluster
ā āāā Application Load Balancer
ā āāā Services:
ā āāā frontend (Load Balanced Web Service)
ā āāā worker (Worker Service)
ā
āāā Environment: "production"
āāā VPC with public/private subnets
āāā ECS Cluster
āāā Application Load Balancer
āāā Services:
āāā frontend
āāā workerService Types
| Type | Use Case | Features |
|---|---|---|
| Load Balanced Web Service | Web apps, APIs | ALB, HTTPS, autoscaling |
| Backend Service | Internal APIs | Service discovery, no public access |
| Worker Service | Background jobs | SQS queue processing |
| Scheduled Job | Cron tasks | EventBridge scheduled execution |
Deployment Workflow
Initialize Application
Create a Copilot application that groups all your services and environments.
Create Environment
Set up a deployment environment (staging, production) with VPC and networking.
Initialize Service
Configure your container service with the appropriate type and settings.
Deploy
Build your container, push to ECR, and deploy to ECS Fargate.
Step 1: Initialize Application
ā Created directory copilot/ for application my-app ā Created application my-app
Step 2: Create Environment
ā Proposing infrastructure changes for stack my-app-staging ā Created environment staging in region ap-southeast-1
ā Deployed staging environment VPC: vpc-0abc123... Subnets: subnet-pub-a, subnet-pub-b, subnet-priv-a, subnet-priv-b
Step 3: Initialize Service
ā Created manifest file copilot/frontend/manifest.yml ā Your manifest contains configurations like port 3000
Step 4: Deploy
Building your container image... Pushing to ECR... Deploying to ECS Fargate... ā Deployed frontend to staging URL: http://my-app-staging-Publi-XXXXX.ap-southeast-1.elb.amazonaws.com
Useful Commands
| Command | Purpose |
|---|---|
copilot svc status | Check service health |
copilot svc logs --follow | Stream logs |
copilot svc exec | SSH into container |
copilot svc pause | Scale to zero (save costs) |
copilot svc resume | Scale back up |
copilot app delete | Delete everything |
Cost Control - Important Commands
copilot svc pause --name frontend --env staging- Scale service to 0 tasks (stops Fargate charges)copilot env delete --name staging- Delete an environment (removes VPC, ALB, NAT Gateway)copilot app delete- Delete entire application and ALL resources (irreversible)
Always delete unused environments to avoid ongoing charges, especially NAT Gateway costs.
When to Use Copilot vs Terraform
| Use Copilot When | Use Terraform When |
|---|---|
| Getting started quickly | Need fine-grained control |
| Standard web app patterns | Complex multi-service architectures |
| Small team, move fast | Infrastructure team, governance needs |
| AWS-only deployment | Multi-cloud deployment |