itsmostafa/aws-agent-skills / skills/ecs
ecs
VerifiedAWS ECS container orchestration for running Docker containers. Use when deploying containerized applications, configuring task definitions, setting up services, managing clusters, or troubleshooting container issues.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 18.3 KB |
| task-definitions.md | markdown | 9.2 KB |
task-definitions.md
View on GitHub# ECS Task Definitions
Detailed patterns for ECS task definitions.
## Task Definition Structure
```json
{
"family": "my-app",
"networkMode": "awsvpc",
"requiresCompatibilities": ["FARGATE"],
"cpu": "256",
"memory": "512",
"executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
"taskRoleArn": "arn:aws:iam::123456789012:role/ecsTaskRole",
"containerDefinitions": [...],
"volumes": [...],
"runtimePlatform": {
"cpuArchitecture": "ARM64",
"operatingSystemFamily": "LINUX"
}
}
```
## CPU and Memory Combinations (Fargate)
| CPU | Memory Options |
|-----|----------------|
| 256 (.25 vCPU) | 512 MB, 1 GB, 2 GB |
| 512 (.5 vCPU) | 1-4 GB (1 GB increments) |
| 1024 (1 vCPU) | 2-8 GB (1 GB increments) |
| 2048 (2 vCPU) | 4-16 GB (1 GB increments) |
| 4096 (4 vCPU) | 8-30 GB (1 GB increments) |
| 8192 (8 vCPU) | 16-60 GB (4 GB increments) |
| 16384 (16 vCPU) | 32-120 GB (8 GB increments) |
| 32768 (32 vCPU) | 60 GB, 120 GB, 244 GB (Linux, x86 or ARM) |
## Container Definition Examples
### Web Application
```json
{
"name": "web",
"image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest",
"essential": true,
"portMappings": [
{
"containerPort": 8080,
"protocol": "tcp",
"appProtocol": "http"
}
],
"environment": [
{"name": "NODE_ENV", "value": "production"},
{"name": "PORT", "value": "8080"}
],
"secrets": [
{
"name": "DB_PASSWORD",
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:db-password:password::"
},
{
"name": "API_KEY",
"valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/my-app/api-key"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-app",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "web"
}
},
"healthCheck": {
"command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 60
}
}
```
### Sidecar Pattern
```json
{
"containerDefinitions": [
{
"name": "app",
"image": "my-app:latest",
"essential": true,
"portMappings": [{"containerPort": 8080}],
"dependsOn": [
{"containerName": "envoy", "condition": "HEALTHY"}
]
},
{
"name": "envoy",
"image": "envoyproxy/envoy:v1.28.0",
"essential": true,
"portMappings": [{"containerPort": 9901}],
"healthCheck": {
"command": ["CMD-SHELL", "curl -f http://localhost:9901/ready || exit 1"],
"interval": 5,
"timeout": 2,
"retries": 3,
"startPeriod": 10
}
},
{
"name": "xray-daemon",
"image": "amazon/aws-xray-daemon",
"essential": false,
"portMappings": [{"containerPort": 2000, "protocol": "udp"}],
"memory": 256
}
]
}
```
### Init Container Pattern
```json
{
"containerDefinitions": [
{
"name": "init-db",
"image": "my-migrations:latest",
"essential": false,
"command": ["./run-migrations.sh"],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-app",
"awslogs-stream-prefix": "init"
}
}
},
{
"name": "app",
"image": "my-app:latest",
"essential": true,
"dependsOn": [
{"containerName": "init-db", "condition": "SUCCESS"}
]
}
]
}
```
## Secrets Management
### From Secrets Manager
```json
{
"secrets": [
{
"name": "FULL_SECRET",
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret"
},
{
"name": "SPECIFIC_KEY",
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret:username::"
},
{
"name": "SPECIFIC_VERSION",
"valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-secret:password::abc123"
}
]
}
```
### From Parameter Store
```json
{
"secrets": [
{
"name": "API_KEY",
"valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/my-app/api-key"
},
{
"name": "DB_HOST",
"valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/my-app/db-host"
}
]
}
```
### Execution Role Permissions
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-1:123456789012:secret:my-app/*"
]
},
{
"Effect": "Allow",
"Action": [
"ssm:GetParameters"
],
"Resource": [
"arn:aws:ssm:us-east-1:123456789012:parameter/my-app/*"
]
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt"
],
"Resource": [
"arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
]
}
]
}
```
## Logging Configurations
### CloudWatch Logs
```json
{
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/my-app",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs",
"awslogs-create-group": "true",
"mode": "non-blocking",
"max-buffer-size": "4m"
}
}
}
```
### FireLens (Fluent Bit)
```json
{
"containerDefinitions": [
{
"name": "log-router",
"image": "amazon/aws-for-fluent-bit:latest",
"essential": true,
"firelensConfiguration": {
"type": "fluentbit",
"options": {
"enable-ecs-log-metadata": "true"
}
}
},
{
"name": "app",
"image": "my-app:latest",
"logConfiguration": {
"logDriver": "awsfirelens",
"options": {
"Name": "cloudwatch",
"region": "us-east-1",
"log_group_name": "/ecs/my-app",
"log_stream_prefix": "app-",
"auto_create_group": "true"
}
}
}
]
}
```
## Volume Mounts
### EFS Volume
```json
{
"volumes": [
{
"name": "shared-data",
"efsVolumeConfiguration": {
"fileSystemId": "fs-12345678",
"rootDirectory": "/",
"transitEncryption": "ENABLED",
"authorizationConfig": {
"accessPointId": "fsap-12345678",
"iam": "ENABLED"
}
}
}
],
"containerDefinitions": [
{
"name": "app",
"mountPoints": [
{
"sourceVolume": "shared-data",
"containerPath": "/data",
"readOnly": false
}
]
}
]
}
```
### Bind Mount (Fargate)
```json
{
"volumes": [
{
"name": "scratch"
}
],
"containerDefinitions": [
{
"name": "app",
"mountPoints": [
{
"sourceVolume": "scratch",
"containerPath": "/tmp/scratch"
}
]
}
]
}
```
### tmpfs (Memory-Backed Scratch)
Linux tasks on Fargate, Managed Instances, and EC2. Good for caches, short-lived secrets, and writable paths with `readonlyRootFilesystem`. Data is gone when the task stops.
```json
{
"containerDefinitions": [
{
"name": "app",
"readonlyRootFilesystem": true,
"linuxParameters": {
"tmpfs": [
{"containerPath": "/tmp", "size": 256, "mountOptions": ["noexec", "nosuid"]}
]
}
}
]
}
```
`size` is MiB (required); `mountOptions` optional.
## Resource Limits
### Per-Container Limits
```json
{
"containerDefinitions": [
{
"name": "app",
"cpu": 512,
"memory": 1024,
"memoryReservation": 512
},
{
"name": "sidecar",
"cpu": 256,
"memory": 512
}
]
}
```
### GPU (EC2 Launch Type)
```json
{
"requiresCompatibilities": ["EC2"],
"containerDefinitions": [
{
"name": "ml-training",
"image": "my-ml-image:latest",
"resourceRequirements": [
{
"type": "GPU",
"value": "1"
}
]
}
]
}
```
## Health Checks
### HTTP Health Check
```json
{
"healthCheck": {
"command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 60
}
}
```
### TCP Health Check
```json
{
"healthCheck": {
"command": ["CMD-SHELL", "nc -z localhost 8080 || exit 1"],
"interval": 30,
"timeout": 5,
"retries": 3
}
}
```
### Script-Based Health Check
```json
{
"healthCheck": {
"command": ["CMD", "/app/healthcheck.sh"],
"interval": 30,
"timeout": 10,
"retries": 3,
"startPeriod": 120
}
}
```
## Container Dependencies
```json
{
"containerDefinitions": [
{
"name": "database",
"essential": true,
"healthCheck": {...}
},
{
"name": "cache",
"essential": false,
"dependsOn": [
{"containerName": "database", "condition": "HEALTHY"}
]
},
{
"name": "app",
"essential": true,
"dependsOn": [
{"containerName": "database", "condition": "HEALTHY"},
{"containerName": "cache", "condition": "START"}
]
}
]
}
```
Conditions:
- `START`: Container has started
- `COMPLETE`: Container ran to completion (any exit code)
- `SUCCESS`: Container exited with code 0
- `HEALTHY`: Container health check passed
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |