ECS Fargate Deployer
An AWS CloudOps agent skill that deploys Amazon ECS services on Fargate
with correct production defaults. Emits a READY_TO_DEPLOY checklist
verifying every configuration item.
Quick navigation
| Need |
Section |
| What MUST be in the response |
"STRICT output contract" |
| Why the deployment order matters |
"Reasoning framework" |
| What to verify before deploying |
"Prerequisites" |
| The ordered deployment steps |
"Deployment procedure" |
| Common silent-failure pitfalls |
"NEVER" |
| Workload-specific defaults |
"Workload matrix" |
| 2024-2026 feature changes |
"Recent AWS features" |
| Deep CLI sequences |
references/deployment-cli-commands.md |
| Networking, ALB, auto-scaling, full NEVER, edge cases |
references/networking-and-scaling-guide.md |
STRICT output contract
When this skill is invoked with an ECS Fargate deployment request, the
agent MUST respond with the READY_TO_DEPLOY checklist defined in "Output
format" using the literal all-caps labels SERVICE:, VERDICT:,
CHECKLIST:, and VERIFICATION_COMMANDS:. Do NOT preface the checklist
with prose, headings, or disclaimers — emit the block as the first lines.
Required output structure
SERVICE: <service-name> — the ECS service being deployed.
VERDICT: READY_TO_DEPLOY OR VERDICT: PREREQUISITES_MISSING.
CHECKLIST: followed by indented lines with status markers
([✓], [✗], [OPTIONAL], [INPUT NEEDED]).
VERIFICATION_COMMANDS: followed by indented aws ecs ... commands.
FORBIDDEN output patterns
- No prose preamble before
SERVICE: — first non-empty line MUST be
SERVICE:.
- No markdown variants of labels — write
VERDICT:, not **VERDICT:**,
### Verdict, or `VERDICT`.
- No swapping verdict tokens — exactly
READY_TO_DEPLOY or
PREREQUISITES_MISSING.
- No omitting
VERIFICATION_COMMANDS: — include even when
PREREQUISITES_MISSING.
- No extra sections after
VERIFICATION_COMMANDS: — the checklist
block is the entire response.
- No status marker drift — use only
[✓], [✗], [OPTIONAL],
[INPUT NEEDED].
Perfect example (copy the shape exactly)
SERVICE: payments-api-prod
VERDICT: READY_TO_DEPLOY
CHECKLIST:
[✓] Cluster — payments-prod (Fargate capacity provider)
[✓] Task definition — payments-api:5 (0.5 vCPU / 1024 MB)
[✓] Container — 123456789012.dkr.ecr.us-east-1.amazonaws.com/payments-api:1.2.3
[✓] Container health check — GET /healthz (30s interval, 5s timeout, 3 retries)
[✓] Networking — awsvpc, subnets subnet-aaa/subnet-bbb, sg-payments-api
[✓] Load balancer — ALB tg-payments-api:8080 (target type ip)
[✓] Desired count — 3 (across 3 AZs)
[✓] Deployment circuit breaker — enabled with rollback
[✓] Minimum healthy percent — 100% / Maximum percent — 200%
[✓] Execution role — payments-exec (ECR + Secrets Manager + SSM)
[✓] Task role — payments-task (DynamoDB + S3 scoped)
[✓] Secrets — DB_PASSWORD from secretsmanager:payments/db:arn
[✓] Logging — FireLens → CloudWatch /ecs/payments-api, retention 30 days
[✓] Auto-scaling — target tracking 60% CPU, min 3 / max 12
VERIFICATION_COMMANDS:
aws ecs describe-services --cluster payments-prod --services payments-api-prod
aws ecs describe-task-definition --task-definition payments-api:5
aws ecs describe-services --cluster payments-prod --services payments-api-prod --query 'services[0].deployments'
aws ec2 describe-security-groups --group-ids sg-payments-api
aws elbv2 describe-target-groups --target-group-arns arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/tg-payments-api/abc
aws logs describe-log-groups --log-group-name-prefix /ecs/payments-api
aws application-autoscaling describe-scaling-policies --service-namespace ecs --resource-id service/payments-prod/payments-api-prod
Reasoning framework (why the deployment order matters)
- Task definition FIRST — a service cannot be created without a valid
taskDefinition ARN. Creating the service first returns ClientException.
- Execution role + task role (separate!) — execution role pulls ECR
image, retrieves secrets, writes logs. Task role is the app's runtime
identity. Conflating them is the #1 IAM mistake on Fargate.
- Cluster + capacity provider — Fargate and Fargate Spot are capacity
providers, not launch types. The launch-type API does not support Spot.
- Networking (awsvpc + subnets + SG) — Fargate REQUIRES
networkMode: awsvpc. Use private subnets across >= 2 AZs. Without a
NAT Gateway, AWS SDK calls fail silently with timeouts.
- Load balancer integration — ALB target group MUST use
target_type=ip (awsvpc tasks register by ENI private IP).
- Container health check + circuit breaker — without a container-level
health check, the circuit breaker cannot fire.
- Auto-scaling — apply AFTER the service is stable, not during
deployment.
Prerequisites (verify before deployment)
| Prerequisite |
Why it matters |
How to verify |
| Cluster |
Must exist with Fargate capacity provider. |
aws ecs describe-clusters --clusters <name> |
| Container image |
ECR image URI with valid tag. |
aws ecr describe-images --repository-name <repo> --image-ids imageTag=<tag> |
| VPC subnets |
Private subnets in >= 2 AZs. |
aws ec2 describe-subnets --subnet-ids <ids> |
| Security group |
Inbound to container ports + outbound for deps. |
aws ec2 describe-security-groups --group-ids <sg> |
| ALB target group (if ALB) |
target_type=ip required. |
aws elbv2 describe-target-groups --target-group-arns <arn> |
| ALB listener (if ALB) |
Listener to attach rules to. |
aws elbv2 describe-listeners --listener-arns <arn> |
| Execution role |
Trust ecs-tasks.amazonaws.com. ECR + Secrets + logs perms. |
aws iam get-role --role-name <exec-role> |
| Task role |
Application permissions (DynamoDB, S3, etc.). |
aws iam get-role --role-name <task-role> |
| Secrets ARNs (if secrets) |
Secrets Manager or SSM Parameter exists. |
aws secretsmanager describe-secret --secret-id <id> |
| CloudWatch log group |
ECS does NOT auto-create log groups. Pre-create with retention. |
aws logs describe-log-groups --log-group-name-prefix /ecs/<service> |
| KMS key (if encrypted) |
Grant execution role kms:Decrypt. |
aws kms describe-key --key-id <alias> |
Deployment procedure (apply in order)
Step 1: Task execution role + task role (separate)
Two distinct roles. Never combine them.
Trust policy (both roles):
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "Service": "ecs-tasks.amazonaws.com" },
"Action": "sts:AssumeRole"
}]
}
Execution role — ECS agent uses it to pull ECR image, retrieve secrets,
write logs. Attach AmazonECSTaskExecutionRolePolicy plus any
secrets/KMS permissions:
{
"Version": "2012-10-17",
"Statement": [
{"Effect": "Allow", "Action": ["ecr:BatchCheckLayerAvailability", "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage"], "Resource": "arn:aws:ecr:<region>:<acct>:repository/<repo>"},
{"Effect": "Allow", "Action": ["ecr:GetAuthorizationToken"], "Resource": "*"},
{"Effect": "Allow", "Action": ["logs:CreateLogStream", "logs:PutLogEvents"], "Resource": "arn:aws:logs:<region>:<acct>:log-group:/ecs/<service>:*"},
{"Effect": "Allow", "Action": ["secretsmanager:GetSecretValue", "ssm:GetParameters"], "Resource": ["arn:aws:secretsmanager:<region>:<acct>:secret:<name>*"]},
{"Effect": "Allow", "Action": ["kms:Decrypt"], "Resource": "arn:aws:kms:<region>:<acct>:key/<id>"}
]
}
Task role — assumed by application code at runtime. Scope to specific
AWS resources (DynamoDB, S3, SQS). Has nothing to do with image pulls.
| Workload |
Task role permissions |
| API backend (DynamoDB) |
dynamodb:GetItem, PutItem, Query on table ARN |
| Queue consumer (SQS) |
sqs:ReceiveMessage, DeleteMessage on queue ARN |
| S3 processor |
s3:GetObject, PutObject on bucket ARN |
NEVER use AdministratorAccess on either role.
Step 2: Task definition (CPU/memory combos)
Fargate enforces specific CPU/memory combinations. Any other combo
fails with ClientException.
| CPU (vCPU) |
Memory options (GB) |
| 0.25 |
0.5, 1, 2 |
| 0.5 |
1, 2, 3, 4 |
| 1 |
2, 3, 4, 5, 6, 7, 8 |
| 2 |
4, 5, 6, ..., 16 |
| 4 |
8, 9, 10, ..., 30 |
| 8 |
16, 17, ..., 60 |
| 16 |
32, 33, ..., 120 |
CPU units: 256 = 0.25 vCPU. Memory: 1024 = 1 GB.
| Workload |
CPU |
Memory |
Rationale |
| Lightweight API |
0.25 vCPU |
0.5 GB |
Low traffic, fast startup |
| Standard API |
0.5 vCPU |
1 GB |
Typical Node/Python API |
| Heavy API (ML inference) |
1-2 vCPU |
4-8 GB |
Parallel processing |
| Worker (queue consumer) |
0.5-1 vCPU |
1-2 GB |
I/O-bound |
| Java/JVM (Spring Boot) |
1-2 vCPU |
4-8 GB |
JVM heap; always >= 2 GB |
Architecture: Fargate supports X86_64 (default) and ARM64
(Graviton, up to 20% price-performance). Set runtimePlatform.cpuArchitecture.
Step 3: Container definitions
[{
"name": "app",
"image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/payments-api:1.2.3",
"cpu": 512, "memory": 1024, "essential": true,
"portMappings": [{"containerPort": 8080, "protocol": "tcp"}],
"environment": [{"name": "LOG_LEVEL", "value": "info"}],
"secrets": [{"name": "DB_PASSWORD", "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:payments/db-XXXXXX"}],
"logConfiguration": {"logDriver": "awslogs", "options": {"awslogs-group": "/ecs/payments-api", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs"}},
"healthCheck": {"command": ["CMD-SHELL", "curl -f http://localhost:8080/healthz || exit 1"], "interval": 30, "timeout": 5, "retries": 3, "startPeriod": 60}
}]
Key fields: image (full ECR URI, NEVER :latest), portMappings
(hostPort ignored on Fargate), environment (plaintext only, NEVER
secrets), secrets (injected at start via ARN reference), healthCheck
(startPeriod gives grace time), essential (true = failure stops task).
Step 4: Service definition
aws ecs create-service \
--cluster payments-prod \
--service-name payments-api-prod \
--task-definition payments-api:5 \
--desired-count 3 \
--launch-type FARGATE \
--network-configuration "awsvpcConfiguration={subnets=[subnet-aaa,subnet-bbb],securityGroups=[sg-payments-api],assignPublicIp=DISABLED}" \
--load-balancers "targetGroupArn=arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/tg-payments-api/abc,containerName=app,containerPort=8080" \
--deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true},minimumHealthyPercent=100,maximumPercent=200" \
--scheduling-strategy REPLICA
Key fields:
- desiredCount — >= 2 across >= 2 AZs for HA.
- deploymentCircuitBreaker —
enable=true, rollback=true auto-rolls
back failed deployments. Without it, a bad task definition leaves service
degraded indefinitely.
- minimumHealthyPercent=100 — old tasks stay until new ones are healthy.
- maximumPercent=200 — allows rolling double during deployment.
- assignPublicIp=DISABLED for private subnets (production).
Capacity-provider-strategy create-service variant moved verbatim to references/deployment-cli-commands.md.
Load on demand when deploying with FARGATE + FARGATE_SPOT burst capacity.
base=2 guarantees 2 On-Demand tasks; remaining split 4:1 between
FARGATE and FARGATE_SPOT. Spot interruption drains tasks gracefully via
the 2-minute warning.
Step 5: Networking (awsvpc mode)
Fargate REQUIRES networkMode: awsvpc. Each task gets a primary ENI.
- Use PRIVATE subnets in production. Tasks do not need public IPs.
- Spread across >= 2 AZs. Set
availabilityZoneRebalancing=ENABLED.
- NAT Gateway for internet access — #1 Fargate networking issue.
Without it, task cannot reach ECR, AWS SDK endpoints, or external APIs.
- VPC endpoints for high-volume traffic (S3, DynamoDB, ECR) to avoid
NAT Gateway charges. Gateway endpoints (S3, DynamoDB) are free.
- Security group — inbound from ALB SG on container port, outbound for
dependencies.
Full networking reference in references/networking-and-scaling-guide.md.
Step 6: Load balancer integration (ALB)
aws elbv2 create-target-group \
--name tg-payments-api --protocol HTTP --port 8080 --vpc-id vpc-xxx \
--target-type ip --health-check-path /healthz \
--health-check-interval-seconds 30 --healthy-threshold-count 2 \
--unhealthy-threshold-count 3 --matcher HttpCode=200
Critical: ALB health check path MUST match the container health check
path. A mismatch causes the ALB to mark the task unhealthy even when ECS
considers it healthy.
Step 7: Secrets (Secrets Manager / SSM Parameter Store)
Secrets are injected as environment variables at container start. NOT
visible in the task definition (only the ARN is).
"secrets": [
{"name": "DB_PASSWORD", "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:payments/db-XXXXXX"},
{"name": "API_KEY", "valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/payments/api-key"}
]
Execution role needs secretsmanager:GetSecretValue or ssm:GetParameters
plus kms:Decrypt if a customer-managed KMS key is used.
Step 8: Logging (FireLens / CloudWatch)
awslogs driver (default):
"logConfiguration": {
"logDriver": "awslogs",
"options": {"awslogs-group": "/ecs/payments-api", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs"}
}
FireLens (advanced routing): route different log streams to different
destinations (audit → S3, app → CloudWatch, metrics → Kinesis). Uses a
sidecar container with firelensConfiguration: {type: fluentbit}.
Pre-create the log group with retention — ECS does NOT auto-create:
aws logs create-log-group --log-group-name /ecs/payments-api
aws logs put-retention-policy --log-group-name /ecs/payments-api --retention-in-days 30
Step 9: Auto-scaling (target tracking)
Step 9 auto-scaling CLI (register-scalable-target + put-scaling-policy) moved verbatim to references/deployment-cli-commands.md.
Load on demand when applying target-tracking auto-scaling after the service is stable.
Metrics: ECSServiceAverageCPUUtilization, ECSServiceAverageMemoryUtilization,
ALBRequestCountPerTarget. Cooldown: scale-out 60s, scale-in 300s (never
< 300s to avoid flapping).
Step 10: Verification
Step 10 verification commands moved verbatim to references/diagnostic-commands.md.
Load on demand for post-deployment verification.
Latest ECS Fargate features (2024-2026)
Latest ECS Fargate features (2024-2026) moved verbatim to references/advanced-patterns.md.
Load on demand for Spot capacity providers, EFA, health-check START_PERIOD, AZ rebalancing, circuit-breaker rollback, Graviton, platform versions, ECS Exec.
Workload matrix
| Workload |
CPU / Memory |
AZ count |
LB |
Auto-scale |
Spot |
Logging |
| Public API |
0.5 vCPU / 1 GB |
3 |
ALB |
CPU 60% |
No |
awslogs |
| Internal API |
0.5 vCPU / 1 GB |
2 |
Internal ALB |
CPU 60% |
Optional |
awslogs |
| Queue worker (SQS) |
0.5-1 vCPU / 1-2 GB |
2 |
None |
Queue depth |
Yes |
awslogs |
| Scheduled batch |
1-2 vCPU / 2-4 GB |
1 |
None |
None |
Yes |
awslogs |
| ML inference |
4 vCPU / 16 GB |
2 |
ALB |
CPU 70% |
No |
FireLens |
| Streaming (Kinesis) |
1 vCPU / 2 GB |
2 |
None |
None |
No |
awslogs |
| Java/Spring Boot |
1-2 vCPU / 4-8 GB |
3 |
ALB |
CPU 65% |
No |
awslogs + startPeriod 60s |
NEVER (top 5 — full list of 14 in references)
- NEVER use
:latest image tag in production. It is mutable — a new push
silently changes what runs. Pin to a version tag or SHA digest. #1
rollback-breaker.
- NEVER combine the execution role and task role into one. Execution role
pulls images and writes logs; task role is the app's identity. Combining
produces pull failures or least-privilege violations.
- NEVER use a target group with
target_type=instance for Fargate. Fargate
tasks register by ENI private IP — only target_type=ip works. Silently
fails registration.
- NEVER deploy Fargate tasks to a public subnet with
assignPublicIp=ENABLED in production. Use private subnets + NAT
Gateway or VPC endpoints.
- NEVER deploy without the deployment circuit breaker when using rolling
deployments. Without
enable=true, rollback=true, a bad task definition
leaves the service degraded indefinitely.
Expert heuristic — choosing CPU, memory, and AZ spread
Expert heuristic (60/70 rule, memory sizing, AZ spread, Spot blend, ALB vs NLB) moved verbatim to references/networking-and-scaling-guide.md.
Load on demand when choosing CPU, memory, and AZ spread.
Pre-flight safety checks (run before any deployment CLI)
- Confirm cluster exists with Fargate capacity provider.
- Confirm ECR image exists — missing image causes
CannotPullContainerError.
- Confirm both roles exist and trust
ecs-tasks.amazonaws.com.
- Confirm target group is
target_type=ip — instance silently fails.
- Confirm subnets are private and span >= 2 AZs.
- Pre-create CloudWatch log group with retention.
- For existing services, capture current config for rollback.
Full CLI sequences for all checks in references/networking-and-scaling-guide.md.
Output format — MANDATORY literal labels
When invoked with a service deployment request, your ENTIRE response MUST
be the checklist block below. The labels are case-sensitive all-caps
keywords. Do NOT write a preamble. Start with SERVICE: and stop after
the VERIFICATION_COMMANDS: block.
SERVICE: <name>
VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING
CHECKLIST:
[✓] Cluster — <cluster> (Fargate capacity provider)
[✓] Task definition — <family>:<rev> (<cpu> vCPU / <memory> MB)
[✓] Container — <image-uri>
[✓] Container health check — <path> (<interval>, <timeout>, <retries>)
[✓] Networking — awsvpc, subnets <subnets>, sg-<name>
[✓] Load balancer — ALB <tg-name>:<port> (target type ip)
[✓] Desired count — <n> (across <az-count> AZs)
[✓] Deployment circuit breaker — enabled with rollback
[✓] Minimum healthy percent — 100% / Maximum percent — 200%
[✓] Execution role — <exec-role> (ECR + Secrets Manager + logs)
[✓] Task role — <task-role> (<service-specific permissions>)
[✓] Secrets — <secret-names> from secretsmanager / ssm
[✓] Logging — FireLens / awslogs → CloudWatch /ecs/<name>, retention <days>
[OPTIONAL] Auto-scaling — target tracking <metric> <target>, min <x> / max <y>
VERIFICATION_COMMANDS:
aws ecs describe-services --cluster <cluster> --services <name>
aws ecs describe-task-definition --task-definition <family>:<rev>
aws ec2 describe-security-groups --group-ids <sg>
aws elbv2 describe-target-health --target-group-arn <tg-arn>
aws logs describe-log-groups --log-group-name-prefix /ecs/<name>
Status marker semantics:
[✓] — applied and verified.
[✗] — NOT applied or misconfigured. Cite the gap.
[OPTIONAL] — recommended but not required.
[INPUT NEEDED] — prerequisite value missing; operator must provide.
PREREQUISITES_MISSING verdict: if any REQUIRED prerequisite is missing
(cluster, task definition, subnets, execution role, target group ARN for
ALB-fronted service), the verdict is PREREQUISITES_MISSING.
References (load on demand)
- references/deployment-cli-commands.md — full copy-pasteable CLI for all 10 deployment steps, plus the capacity-provider-strategy variant and auto-scaling CLI moved from SKILL.md.
- references/networking-and-scaling-guide.md — awsvpc networking, ALB integration, auto-scaling, Spot strategy, full NEVER list, plus the expert heuristic and edge-case quick list moved from SKILL.md.
- references/diagnostic-commands.md — Step 10 verification commands moved from SKILL.md.
- references/advanced-patterns.md — latest ECS Fargate features (2024-2026) moved from SKILL.md.
Domain
AWS CloudOps / ECS Fargate Container Compute Provisioning.
Edge-case handling
Edge-case quick list moved verbatim to references/networking-and-scaling-guide.md.
Load on demand for cross-account ECR, ECS Exec, health-check divergence, slow-start JVM, Spot drain, capacity-provider lock-in, Service Connect/Cloud Map.
AWS documentation
References
references/deployment-cli-commands.md — full copy-pasteable CLI command
sequence for all 10 deployment steps, including execution role + task role
creation, task definition registration, service creation, ALB target group
- listener rule, auto-scaling, and Terraform equivalents.
references/networking-and-scaling-guide.md — deep reference on awsvpc
networking (ENI lifecycle, NAT Gateway vs VPC endpoints), ALB integration,
target-tracking auto-scaling, Fargate Spot strategy, full NEVER list,
edge-case handling, expert heuristics, and pre-flight safety CLI.
1---2name: ecs-fargate-deployer3description: 'Deploys AWS ECS Fargate services with production-grade configuration: right-sized task definition (CPU/memory combos, Fargate sizing), container definitions (image, port mappings, env vars, health checks), service definition (desired count, deployment circuit breaker, minimum healthy percent), awsvpc networking (security groups, subnets), ALB integration (target group, listener rules), target-tracking auto-scaling (CPU/memory/ALB request count), separate task execution role and task role, secrets via Secrets Manager / SSM Parameter Store, FireLens and CloudWatch logging, and latest features (Fargate Spot, EFA, container health check improvements). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when creating a new ECS Fargate service, deploying a container to production, validating an ECS service configuration, or generating deployment CLI and IaC templates. Triggers: ECS Fargate, task definition, service, ALB, auto-scaling, container, deployment, ECS deploy.'4license: Apache-2.05compatibility: 'Requires an LLM agent runtime (Claude Code, Cursor, Windsurf, Codex, Gemini). For live deployment: AWS CLI v2 with ecs, ec2, iam, elasticloadbalancingv2, servicediscovery, logs, secretsmanager, and ssm access. Works with Terraform aws_ecs_service / aws_ecs_task_definition resources, CloudFormation AWS::ECS::* resources, and AWS Copilot.'6metadata:7 source: https://skillmd.com/skills/jhkchan/ecs-fargate-deployer8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '1'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Compute15 task_type: deploy16 skill_class: capability17 lifecycle_status: active18 verdict_shape: READY_TO_DEPLOY | PREREQUISITES_MISSING19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 tags: aws, ecs, fargate, cloudops, deploy, containers, task-definition, awsvpc, alb, auto-scaling22 dependencies: aws-orchestrator23 keywords: aws, ecs, fargate, cloudops, deploy, provisioning, containers, task-definition, awsvpc, alb, target-group, auto-scaling, circuit-breaker, firelens, fargate-spot24 when_to_use: Invoke when the user wants to create a new ECS Fargate service, deploy a container workload to Fargate, validate an existing ECS service configuration against best practices, generate deployment CLI commands or IaC templates, or troubleshoot a Fargate deployment failure caused by missing prerequisites (task definition, subnets, ALB, execution role, secrets). Do NOT invoke for ECS on EC2 deployments (use an EC2-launch-type-specific skill) or for EKS deployments (use an EKS skill).25---2627# ECS Fargate Deployer2829An AWS CloudOps agent skill that deploys Amazon ECS services on Fargate30with correct production defaults. Emits a READY_TO_DEPLOY checklist31verifying every configuration item.3233## Quick navigation3435| Need | Section |36|---|---|37| What MUST be in the response | "STRICT output contract" |38| Why the deployment order matters | "Reasoning framework" |39| What to verify before deploying | "Prerequisites" |40| The ordered deployment steps | "Deployment procedure" |41| Common silent-failure pitfalls | "NEVER" |42| Workload-specific defaults | "Workload matrix" |43| 2024-2026 feature changes | "Recent AWS features" |44| Deep CLI sequences | `references/deployment-cli-commands.md` |45| Networking, ALB, auto-scaling, full NEVER, edge cases | `references/networking-and-scaling-guide.md` |4647## STRICT output contract4849When this skill is invoked with an ECS Fargate deployment request, the50agent MUST respond with the READY_TO_DEPLOY checklist defined in "Output51format" using the literal all-caps labels `SERVICE:`, `VERDICT:`,52`CHECKLIST:`, and `VERIFICATION_COMMANDS:`. Do NOT preface the checklist53with prose, headings, or disclaimers — emit the block as the first lines.5455### Required output structure56571. `SERVICE: <service-name>` — the ECS service being deployed.582. `VERDICT: READY_TO_DEPLOY` OR `VERDICT: PREREQUISITES_MISSING`.593. `CHECKLIST:` followed by indented lines with status markers60 (`[✓]`, `[✗]`, `[OPTIONAL]`, `[INPUT NEEDED]`).614. `VERIFICATION_COMMANDS:` followed by indented `aws ecs ...` commands.6263### FORBIDDEN output patterns6465- **No prose preamble before `SERVICE:`** — first non-empty line MUST be66 `SERVICE:`.67- **No markdown variants of labels** — write `VERDICT:`, not `**VERDICT:**`,68 `### Verdict`, or `` `VERDICT` ``.69- **No swapping verdict tokens** — exactly `READY_TO_DEPLOY` or70 `PREREQUISITES_MISSING`.71- **No omitting `VERIFICATION_COMMANDS:`** — include even when72 PREREQUISITES_MISSING.73- **No extra sections after `VERIFICATION_COMMANDS:`** — the checklist74 block is the entire response.75- **No status marker drift** — use only `[✓]`, `[✗]`, `[OPTIONAL]`,76 `[INPUT NEEDED]`.7778### Perfect example (copy the shape exactly)7980```text81SERVICE: payments-api-prod82VERDICT: READY_TO_DEPLOY83CHECKLIST:84 [✓] Cluster — payments-prod (Fargate capacity provider)85 [✓] Task definition — payments-api:5 (0.5 vCPU / 1024 MB)86 [✓] Container — 123456789012.dkr.ecr.us-east-1.amazonaws.com/payments-api:1.2.387 [✓] Container health check — GET /healthz (30s interval, 5s timeout, 3 retries)88 [✓] Networking — awsvpc, subnets subnet-aaa/subnet-bbb, sg-payments-api89 [✓] Load balancer — ALB tg-payments-api:8080 (target type ip)90 [✓] Desired count — 3 (across 3 AZs)91 [✓] Deployment circuit breaker — enabled with rollback92 [✓] Minimum healthy percent — 100% / Maximum percent — 200%93 [✓] Execution role — payments-exec (ECR + Secrets Manager + SSM)94 [✓] Task role — payments-task (DynamoDB + S3 scoped)95 [✓] Secrets — DB_PASSWORD from secretsmanager:payments/db:arn96 [✓] Logging — FireLens → CloudWatch /ecs/payments-api, retention 30 days97 [✓] Auto-scaling — target tracking 60% CPU, min 3 / max 1298VERIFICATION_COMMANDS:99 aws ecs describe-services --cluster payments-prod --services payments-api-prod100 aws ecs describe-task-definition --task-definition payments-api:5101 aws ecs describe-services --cluster payments-prod --services payments-api-prod --query 'services[0].deployments'102 aws ec2 describe-security-groups --group-ids sg-payments-api103 aws elbv2 describe-target-groups --target-group-arns arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/tg-payments-api/abc104 aws logs describe-log-groups --log-group-name-prefix /ecs/payments-api105 aws application-autoscaling describe-scaling-policies --service-namespace ecs --resource-id service/payments-prod/payments-api-prod106```107108## Reasoning framework (why the deployment order matters)1091101. **Task definition FIRST** — a service cannot be created without a valid111 `taskDefinition` ARN. Creating the service first returns `ClientException`.1122. **Execution role + task role (separate!)** — execution role pulls ECR113 image, retrieves secrets, writes logs. Task role is the app's runtime114 identity. Conflating them is the #1 IAM mistake on Fargate.1153. **Cluster + capacity provider** — Fargate and Fargate Spot are capacity116 providers, not launch types. The launch-type API does not support Spot.1174. **Networking (awsvpc + subnets + SG)** — Fargate REQUIRES118 `networkMode: awsvpc`. Use private subnets across >= 2 AZs. Without a119 NAT Gateway, AWS SDK calls fail silently with timeouts.1205. **Load balancer integration** — ALB target group MUST use121 `target_type=ip` (awsvpc tasks register by ENI private IP).1226. **Container health check + circuit breaker** — without a container-level123 health check, the circuit breaker cannot fire.1247. **Auto-scaling** — apply AFTER the service is stable, not during125 deployment.126127## Prerequisites (verify before deployment)128129| Prerequisite | Why it matters | How to verify |130|---|---|---|131| **Cluster** | Must exist with Fargate capacity provider. | `aws ecs describe-clusters --clusters <name>` |132| **Container image** | ECR image URI with valid tag. | `aws ecr describe-images --repository-name <repo> --image-ids imageTag=<tag>` |133| **VPC subnets** | Private subnets in >= 2 AZs. | `aws ec2 describe-subnets --subnet-ids <ids>` |134| **Security group** | Inbound to container ports + outbound for deps. | `aws ec2 describe-security-groups --group-ids <sg>` |135| **ALB target group** (if ALB) | `target_type=ip` required. | `aws elbv2 describe-target-groups --target-group-arns <arn>` |136| **ALB listener** (if ALB) | Listener to attach rules to. | `aws elbv2 describe-listeners --listener-arns <arn>` |137| **Execution role** | Trust `ecs-tasks.amazonaws.com`. ECR + Secrets + logs perms. | `aws iam get-role --role-name <exec-role>` |138| **Task role** | Application permissions (DynamoDB, S3, etc.). | `aws iam get-role --role-name <task-role>` |139| **Secrets ARNs** (if secrets) | Secrets Manager or SSM Parameter exists. | `aws secretsmanager describe-secret --secret-id <id>` |140| **CloudWatch log group** | ECS does NOT auto-create log groups. Pre-create with retention. | `aws logs describe-log-groups --log-group-name-prefix /ecs/<service>` |141| **KMS key** (if encrypted) | Grant execution role `kms:Decrypt`. | `aws kms describe-key --key-id <alias>` |142143## Deployment procedure (apply in order)144145### Step 1: Task execution role + task role (separate)146147**Two distinct roles. Never combine them.**148149Trust policy (both roles):150```json151{152 "Version": "2012-10-17",153 "Statement": [{154 "Effect": "Allow",155 "Principal": { "Service": "ecs-tasks.amazonaws.com" },156 "Action": "sts:AssumeRole"157 }]158}159```160161**Execution role** — ECS agent uses it to pull ECR image, retrieve secrets,162write logs. Attach `AmazonECSTaskExecutionRolePolicy` plus any163secrets/KMS permissions:164165```json166{167 "Version": "2012-10-17",168 "Statement": [169 {"Effect": "Allow", "Action": ["ecr:BatchCheckLayerAvailability", "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage"], "Resource": "arn:aws:ecr:<region>:<acct>:repository/<repo>"},170 {"Effect": "Allow", "Action": ["ecr:GetAuthorizationToken"], "Resource": "*"},171 {"Effect": "Allow", "Action": ["logs:CreateLogStream", "logs:PutLogEvents"], "Resource": "arn:aws:logs:<region>:<acct>:log-group:/ecs/<service>:*"},172 {"Effect": "Allow", "Action": ["secretsmanager:GetSecretValue", "ssm:GetParameters"], "Resource": ["arn:aws:secretsmanager:<region>:<acct>:secret:<name>*"]},173 {"Effect": "Allow", "Action": ["kms:Decrypt"], "Resource": "arn:aws:kms:<region>:<acct>:key/<id>"}174 ]175}176```177178**Task role** — assumed by application code at runtime. Scope to specific179AWS resources (DynamoDB, S3, SQS). Has nothing to do with image pulls.180181| Workload | Task role permissions |182|---|---|183| API backend (DynamoDB) | `dynamodb:GetItem`, `PutItem`, `Query` on table ARN |184| Queue consumer (SQS) | `sqs:ReceiveMessage`, `DeleteMessage` on queue ARN |185| S3 processor | `s3:GetObject`, `PutObject` on bucket ARN |186187**NEVER use `AdministratorAccess` on either role.**188189### Step 2: Task definition (CPU/memory combos)190191Fargate enforces **specific CPU/memory combinations**. Any other combo192fails with `ClientException`.193194| CPU (vCPU) | Memory options (GB) |195|---|---|196| 0.25 | 0.5, 1, 2 |197| 0.5 | 1, 2, 3, 4 |198| 1 | 2, 3, 4, 5, 6, 7, 8 |199| 2 | 4, 5, 6, ..., 16 |200| 4 | 8, 9, 10, ..., 30 |201| 8 | 16, 17, ..., 60 |202| 16 | 32, 33, ..., 120 |203204CPU units: 256 = 0.25 vCPU. Memory: 1024 = 1 GB.205206| Workload | CPU | Memory | Rationale |207|---|---|---|---|208| Lightweight API | 0.25 vCPU | 0.5 GB | Low traffic, fast startup |209| Standard API | 0.5 vCPU | 1 GB | Typical Node/Python API |210| Heavy API (ML inference) | 1-2 vCPU | 4-8 GB | Parallel processing |211| Worker (queue consumer) | 0.5-1 vCPU | 1-2 GB | I/O-bound |212| Java/JVM (Spring Boot) | 1-2 vCPU | 4-8 GB | JVM heap; always >= 2 GB |213214**Architecture:** Fargate supports `X86_64` (default) and `ARM64`215(Graviton, up to 20% price-performance). Set `runtimePlatform.cpuArchitecture`.216217### Step 3: Container definitions218219```json220[{221 "name": "app",222 "image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/payments-api:1.2.3",223 "cpu": 512, "memory": 1024, "essential": true,224 "portMappings": [{"containerPort": 8080, "protocol": "tcp"}],225 "environment": [{"name": "LOG_LEVEL", "value": "info"}],226 "secrets": [{"name": "DB_PASSWORD", "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:payments/db-XXXXXX"}],227 "logConfiguration": {"logDriver": "awslogs", "options": {"awslogs-group": "/ecs/payments-api", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs"}},228 "healthCheck": {"command": ["CMD-SHELL", "curl -f http://localhost:8080/healthz || exit 1"], "interval": 30, "timeout": 5, "retries": 3, "startPeriod": 60}229}]230```231232Key fields: **image** (full ECR URI, NEVER `:latest`), **portMappings**233(`hostPort` ignored on Fargate), **environment** (plaintext only, NEVER234secrets), **secrets** (injected at start via ARN reference), **healthCheck**235(`startPeriod` gives grace time), **essential** (true = failure stops task).236237### Step 4: Service definition238239```bash240aws ecs create-service \241 --cluster payments-prod \242 --service-name payments-api-prod \243 --task-definition payments-api:5 \244 --desired-count 3 \245 --launch-type FARGATE \246 --network-configuration "awsvpcConfiguration={subnets=[subnet-aaa,subnet-bbb],securityGroups=[sg-payments-api],assignPublicIp=DISABLED}" \247 --load-balancers "targetGroupArn=arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/tg-payments-api/abc,containerName=app,containerPort=8080" \248 --deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true},minimumHealthyPercent=100,maximumPercent=200" \249 --scheduling-strategy REPLICA250```251252Key fields:253- **desiredCount** — >= 2 across >= 2 AZs for HA.254- **deploymentCircuitBreaker** — `enable=true, rollback=true` auto-rolls255 back failed deployments. Without it, a bad task definition leaves service256 degraded indefinitely.257- **minimumHealthyPercent=100** — old tasks stay until new ones are healthy.258- **maximumPercent=200** — allows rolling double during deployment.259- **assignPublicIp=DISABLED** for private subnets (production).260261Capacity-provider-strategy create-service variant moved verbatim to [references/deployment-cli-commands.md](references/deployment-cli-commands.md).262Load on demand when deploying with FARGATE + FARGATE_SPOT burst capacity.263264`base=2` guarantees 2 On-Demand tasks; remaining split 4:1 between265FARGATE and FARGATE_SPOT. Spot interruption drains tasks gracefully via266the 2-minute warning.267268### Step 5: Networking (awsvpc mode)269270Fargate REQUIRES `networkMode: awsvpc`. Each task gets a primary ENI.271272- **Use PRIVATE subnets** in production. Tasks do not need public IPs.273- **Spread across >= 2 AZs.** Set `availabilityZoneRebalancing=ENABLED`.274- **NAT Gateway for internet access** — #1 Fargate networking issue.275 Without it, task cannot reach ECR, AWS SDK endpoints, or external APIs.276- **VPC endpoints** for high-volume traffic (S3, DynamoDB, ECR) to avoid277 NAT Gateway charges. Gateway endpoints (S3, DynamoDB) are free.278- **Security group** — inbound from ALB SG on container port, outbound for279 dependencies.280281Full networking reference in `references/networking-and-scaling-guide.md`.282283### Step 6: Load balancer integration (ALB)284285```bash286aws elbv2 create-target-group \287 --name tg-payments-api --protocol HTTP --port 8080 --vpc-id vpc-xxx \288 --target-type ip --health-check-path /healthz \289 --health-check-interval-seconds 30 --healthy-threshold-count 2 \290 --unhealthy-threshold-count 3 --matcher HttpCode=200291```292293**Critical:** ALB health check path MUST match the container health check294path. A mismatch causes the ALB to mark the task unhealthy even when ECS295considers it healthy.296297### Step 7: Secrets (Secrets Manager / SSM Parameter Store)298299Secrets are injected as environment variables at container start. NOT300visible in the task definition (only the ARN is).301302```json303"secrets": [304 {"name": "DB_PASSWORD", "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:payments/db-XXXXXX"},305 {"name": "API_KEY", "valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/payments/api-key"}306]307```308309Execution role needs `secretsmanager:GetSecretValue` or `ssm:GetParameters`310plus `kms:Decrypt` if a customer-managed KMS key is used.311312### Step 8: Logging (FireLens / CloudWatch)313314**awslogs driver (default):**315```json316"logConfiguration": {317 "logDriver": "awslogs",318 "options": {"awslogs-group": "/ecs/payments-api", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "ecs"}319}320```321322**FireLens (advanced routing):** route different log streams to different323destinations (audit → S3, app → CloudWatch, metrics → Kinesis). Uses a324sidecar container with `firelensConfiguration: {type: fluentbit}`.325326Pre-create the log group with retention — ECS does NOT auto-create:327```bash328aws logs create-log-group --log-group-name /ecs/payments-api329aws logs put-retention-policy --log-group-name /ecs/payments-api --retention-in-days 30330```331332### Step 9: Auto-scaling (target tracking)333334Step 9 auto-scaling CLI (register-scalable-target + put-scaling-policy) moved verbatim to [references/deployment-cli-commands.md](references/deployment-cli-commands.md).335Load on demand when applying target-tracking auto-scaling after the service is stable.336337Metrics: `ECSServiceAverageCPUUtilization`, `ECSServiceAverageMemoryUtilization`,338`ALBRequestCountPerTarget`. Cooldown: scale-out 60s, scale-in 300s (never339< 300s to avoid flapping).340341### Step 10: Verification342343Step 10 verification commands moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).344Load on demand for post-deployment verification.345346## Latest ECS Fargate features (2024-2026)347348Latest ECS Fargate features (2024-2026) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).349Load on demand for Spot capacity providers, EFA, health-check START_PERIOD, AZ rebalancing, circuit-breaker rollback, Graviton, platform versions, ECS Exec.350351## Workload matrix352353| Workload | CPU / Memory | AZ count | LB | Auto-scale | Spot | Logging |354|---|---|---|---|---|---|---|355| **Public API** | 0.5 vCPU / 1 GB | 3 | ALB | CPU 60% | No | awslogs |356| **Internal API** | 0.5 vCPU / 1 GB | 2 | Internal ALB | CPU 60% | Optional | awslogs |357| **Queue worker (SQS)** | 0.5-1 vCPU / 1-2 GB | 2 | None | Queue depth | Yes | awslogs |358| **Scheduled batch** | 1-2 vCPU / 2-4 GB | 1 | None | None | Yes | awslogs |359| **ML inference** | 4 vCPU / 16 GB | 2 | ALB | CPU 70% | No | FireLens |360| **Streaming (Kinesis)** | 1 vCPU / 2 GB | 2 | None | None | No | awslogs |361| **Java/Spring Boot** | 1-2 vCPU / 4-8 GB | 3 | ALB | CPU 65% | No | awslogs + startPeriod 60s |362363## NEVER (top 5 — full list of 14 in references)364365- NEVER use `:latest` image tag in production. It is mutable — a new push366 silently changes what runs. Pin to a version tag or SHA digest. #1367 rollback-breaker.368- NEVER combine the execution role and task role into one. Execution role369 pulls images and writes logs; task role is the app's identity. Combining370 produces pull failures or least-privilege violations.371- NEVER use a target group with `target_type=instance` for Fargate. Fargate372 tasks register by ENI private IP — only `target_type=ip` works. Silently373 fails registration.374- NEVER deploy Fargate tasks to a public subnet with375 `assignPublicIp=ENABLED` in production. Use private subnets + NAT376 Gateway or VPC endpoints.377- NEVER deploy without the deployment circuit breaker when using rolling378 deployments. Without `enable=true, rollback=true`, a bad task definition379 leaves the service degraded indefinitely.380381## Expert heuristic — choosing CPU, memory, and AZ spread382383Expert heuristic (60/70 rule, memory sizing, AZ spread, Spot blend, ALB vs NLB) moved verbatim to [references/networking-and-scaling-guide.md](references/networking-and-scaling-guide.md).384Load on demand when choosing CPU, memory, and AZ spread.385386## Pre-flight safety checks (run before any deployment CLI)387388- **Confirm cluster exists with Fargate capacity provider.**389- **Confirm ECR image exists** — missing image causes `CannotPullContainerError`.390- **Confirm both roles exist** and trust `ecs-tasks.amazonaws.com`.391- **Confirm target group is `target_type=ip`** — `instance` silently fails.392- **Confirm subnets are private and span >= 2 AZs.**393- **Pre-create CloudWatch log group with retention.**394- **For existing services, capture current config for rollback.**395396Full CLI sequences for all checks in `references/networking-and-scaling-guide.md`.397398## Output format — MANDATORY literal labels399400When invoked with a service deployment request, your ENTIRE response MUST401be the checklist block below. The labels are **case-sensitive all-caps402keywords**. Do NOT write a preamble. Start with `SERVICE:` and stop after403the `VERIFICATION_COMMANDS:` block.404405```text406SERVICE: <name>407VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING408CHECKLIST:409 [✓] Cluster — <cluster> (Fargate capacity provider)410 [✓] Task definition — <family>:<rev> (<cpu> vCPU / <memory> MB)411 [✓] Container — <image-uri>412 [✓] Container health check — <path> (<interval>, <timeout>, <retries>)413 [✓] Networking — awsvpc, subnets <subnets>, sg-<name>414 [✓] Load balancer — ALB <tg-name>:<port> (target type ip)415 [✓] Desired count — <n> (across <az-count> AZs)416 [✓] Deployment circuit breaker — enabled with rollback417 [✓] Minimum healthy percent — 100% / Maximum percent — 200%418 [✓] Execution role — <exec-role> (ECR + Secrets Manager + logs)419 [✓] Task role — <task-role> (<service-specific permissions>)420 [✓] Secrets — <secret-names> from secretsmanager / ssm421 [✓] Logging — FireLens / awslogs → CloudWatch /ecs/<name>, retention <days>422 [OPTIONAL] Auto-scaling — target tracking <metric> <target>, min <x> / max <y>423VERIFICATION_COMMANDS:424 aws ecs describe-services --cluster <cluster> --services <name>425 aws ecs describe-task-definition --task-definition <family>:<rev>426 aws ec2 describe-security-groups --group-ids <sg>427 aws elbv2 describe-target-health --target-group-arn <tg-arn>428 aws logs describe-log-groups --log-group-name-prefix /ecs/<name>429```430431**Status marker semantics:**432- `[✓]` — applied and verified.433- `[✗]` — NOT applied or misconfigured. Cite the gap.434- `[OPTIONAL]` — recommended but not required.435- `[INPUT NEEDED]` — prerequisite value missing; operator must provide.436437**PREREQUISITES_MISSING verdict:** if any REQUIRED prerequisite is missing438(cluster, task definition, subnets, execution role, target group ARN for439ALB-fronted service), the verdict is `PREREQUISITES_MISSING`.440441## References (load on demand)442443- [references/deployment-cli-commands.md](references/deployment-cli-commands.md) — full copy-pasteable CLI for all 10 deployment steps, plus the capacity-provider-strategy variant and auto-scaling CLI moved from SKILL.md.444- [references/networking-and-scaling-guide.md](references/networking-and-scaling-guide.md) — awsvpc networking, ALB integration, auto-scaling, Spot strategy, full NEVER list, plus the expert heuristic and edge-case quick list moved from SKILL.md.445- [references/diagnostic-commands.md](references/diagnostic-commands.md) — Step 10 verification commands moved from SKILL.md.446- [references/advanced-patterns.md](references/advanced-patterns.md) — latest ECS Fargate features (2024-2026) moved from SKILL.md.447448## Domain449450AWS CloudOps / ECS Fargate Container Compute Provisioning.451452## Edge-case handling453454Edge-case quick list moved verbatim to [references/networking-and-scaling-guide.md](references/networking-and-scaling-guide.md).455Load on demand for cross-account ECR, ECS Exec, health-check divergence, slow-start JVM, Spot drain, capacity-provider lock-in, Service Connect/Cloud Map.456457## AWS documentation458459- **Amazon ECS Developer Guide** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html460- **ECS Fargate** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html461- **ECS Task Definition** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html462- **ECS Service** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html463- **Fargate CPU/Memory** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size464- **ECS Capacity Providers** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html465- **ECS Deployment Circuit Breaker** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-circuit-breaker.html466- **ECS Logging with FireLens** — https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html467- **ECS CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/ecs/468469## References470471- `references/deployment-cli-commands.md` — full copy-pasteable CLI command472 sequence for all 10 deployment steps, including execution role + task role473 creation, task definition registration, service creation, ALB target group474 + listener rule, auto-scaling, and Terraform equivalents.475476- `references/networking-and-scaling-guide.md` — deep reference on awsvpc477 networking (ENI lifecycle, NAT Gateway vs VPC endpoints), ALB integration,478 target-tracking auto-scaling, Fargate Spot strategy, full NEVER list,479 edge-case handling, expert heuristics, and pre-flight safety CLI.