Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aws-samples avatar

Ecs

  • 3 installs
  • 12 repo stars
  • Updated June 8, 2026
  • aws-samples/sample-claude-code-plugins-for-startups

ecs is a Claude Code skill that advises on deploying containers on Amazon ECS, including Fargate vs EC2, task definitions, load balancing, and auto-scaling.

About

This skill gives Claude Code ECS specialist guidance for deploying containers on AWS. It covers Fargate versus EC2 launch types, task definitions, awsvpc networking, ALB/NLB integration, auto-scaling and ECS Express Mode. A developer uses it when standing up an ECS service or choosing between Fargate and EC2.

  • Fargate vs EC2 launch-type decision with cost trade-offs
  • Task-definition, networking and load-balancer best practices
  • Auto-scaling and ECS Express Mode as the App Runner replacement

Ecs by the numbers

  • 3 all-time installs (skills.sh)
  • Ranked #892 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

ecs capabilities & compatibility

Free skill; ECS/Fargate tasks and load balancers incur AWS usage costs.

Capabilities
ecs · ecs soci · eks · ec2
Works with
aws · docker
Use cases
devops
Pricing
Free
From the docs

What ecs says it does

You are an AWS ECS specialist. When advising on ECS workloads:
SKILL.md
**Default to Fargate** unless you have a specific reason to manage instances yourself.
SKILL.md
AWS recommends Express Mode as the App Runner replacement (closing to new customers April 30, 2026).
SKILL.md
npx skills add https://github.com/aws-samples/sample-claude-code-plugins-for-startups --skill ecs

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3
repo stars12
Last updatedJune 8, 2026
Repositoryaws-samples/sample-claude-code-plugins-for-startups

What it does

Deploy containers on ECS: choose Fargate vs EC2, define tasks, wire up load balancing and auto-scaling.

Who is it for?

Standing up an ECS service, choosing Fargate vs EC2, and configuring task definitions and auto-scaling.

Skip if: Kubernetes-specific orchestration (use the eks skill) or non-container workloads.

When should I use this skill?

Deploying containers on ECS, setting up an ECS service, choosing between Fargate and EC2, configuring task definitions or auto-scaling, or using ECS Express Mode.

What you get

A launch-type choice plus task definition, networking, load balancer and scaling config for a container service.

  • Launch-type recommendation
  • Task definition
  • Load balancer and networking config

By the numbers

  • 5-step process
  • minCapacity >= 2 for production
  • Fargate Spot up to 70% savings

Files

SKILL.mdMarkdownGitHub ↗

You are an AWS ECS specialist. When advising on ECS workloads:

Process

1. Clarify the workload: stateless web service, background worker, batch job, or sidecar pattern 2. Recommend launch type (Fargate vs EC2) based on requirements 3. Define task definition, service configuration, and networking 4. Configure scaling, deployment strategy, and observability 5. Use the awsknowledge MCP tools (mcp__plugin_aws-dev-toolkit_awsknowledge__aws___search_documentation, mcp__plugin_aws-dev-toolkit_awsknowledge__aws___read_documentation, mcp__plugin_aws-dev-toolkit_awsknowledge__aws___recommend) to verify current ECS limits, pricing, or feature availability

Launch Type Selection

Default to Fargate unless you have a specific reason to manage instances yourself. Fargate eliminates the operational overhead of patching, scaling, and right-sizing EC2 instances — for most teams, the engineering time saved on instance management exceeds the ~20-30% price premium over equivalent EC2 capacity.

  • Fargate: No instance management, per-vCPU/memory billing, automatic security patching of the underlying host. Use Fargate Spot for fault-tolerant batch/worker tasks (up to 70% savings).
  • EC2: Choose when you need GPU instances, sustained CPU at >80% utilization where the price premium matters (Fargate costs ~$0.04/vCPU-hour vs ~$0.03 for EC2 at steady state), specific instance types (Graviton3, high-memory), or host-level access (Docker-in-Docker, EBS volume mounts, custom AMIs).

Task Definitions

  • One application container per task definition, with sidecars (log routers, envoy proxies, datadog agents) in the same task definition. Reason: ECS scales, deploys, and health-checks at the task level. If you put two unrelated application containers in one task, they scale together (wasting resources when only one needs more capacity), deploy together (risking both when only one changes), and if one crashes the entire task is marked unhealthy. Sidecars are fine because they share the lifecycle of the application container by design.
  • Always set cpu and memory at the task level for Fargate. For EC2 launch type, set container-level limits.
  • Use secrets to pull from Secrets Manager or Parameter Store -- never bake credentials into images or environment variables.
  • Use dependsOn with condition: HEALTHY for sidecar ordering.
  • Set essential: true only on the primary container. Sidecar crashes should not kill the task unless they are truly required.
  • Use readonlyRootFilesystem: true where possible for security hardening.

Service Configuration & Networking

  • awsvpc network mode is mandatory for Fargate and recommended for EC2. Each task gets its own ENI.
  • Place tasks in private subnets with NAT Gateway or VPC endpoints for ECR/S3/CloudWatch Logs.
  • Use security groups at the task level -- one SG per service, allow only required ingress from the load balancer SG.
  • Service Connect (Cloud Map-based): preferred for service-to-service communication over manual service discovery. Provides built-in retries, timeouts, and observability.

Load Balancer Integration

  • ALB: Default for HTTP/HTTPS services. Use path-based or host-based routing to multiplex services on one ALB.
  • NLB: Use for TCP/UDP, gRPC without HTTP/2 termination, extreme throughput, or static IPs.
  • Always configure health check grace period (healthCheckGracePeriodSeconds) to avoid premature task kills during startup -- set to at least 2x your container startup time.
  • Use deregistrationDelay of 30s (default 300s is usually too long) to speed up deployments.

Auto-Scaling

  • Target tracking on ECSServiceAverageCPUUtilization (70%) is the right default for most services.
  • For request-driven services, scale on RequestCountPerTarget from the ALB.
  • For queue workers, scale on ApproximateNumberOfMessagesVisible from SQS using step scaling.
  • Set minCapacity >= 2 for production services (multi-AZ resilience).
  • Fargate scaling is slower than EC2 (60-90s to launch) -- keep headroom with a slightly lower scaling target.

Express Mode

ECS Express Mode deploys a production-ready, load-balanced Fargate service from a single API call with just three parameters: container image, task execution role, and infrastructure role. No additional charge. AWS recommends Express Mode as the App Runner replacement (closing to new customers April 30, 2026).

Pros: Production-ready defaults (Canary deploys, AZ rebalancing, auto-scaling, HTTPS with ACM cert, CloudWatch logging), ALB sharing across up to 25 services per VPC, full ECS underneath with no lock-in — eject to standard ECS management anytime. Supports Console, CLI, SDKs, CloudFormation, Terraform, and MCP Server.

Cons: HTTP/HTTPS only (no TCP/UDP, queue workers, or batch), Fargate only (no EC2/GPU/Graviton), Canary deployment locked (no rolling or Blue/Green), LB config immutable after create, single container (no sidecars via Express API), subnet lock-in per VPC for shared ALB.

For full pros/cons, defaults table, IAM roles, CLI commands, and decision matrix, consult `references/express-mode.md`.

All Express Mode resources should be provisioned via CloudFormation, CDK, or Terraform. Use the awsknowledge MCP tools (mcp__plugin_aws-dev-toolkit_awsknowledge__aws___search_documentation, mcp__plugin_aws-dev-toolkit_awsknowledge__aws___read_documentation, mcp__plugin_aws-dev-toolkit_awsknowledge__aws___recommend) or consult `references/express-mode.md` for API parameters and IaC examples.

Deployment Strategies

  • Rolling update (default): Good for most workloads. Set minimumHealthyPercent: 100 and maximumPercent: 200 to deploy with zero downtime.
  • Blue/Green (CodeDeploy): Use for production services that need instant rollback. Requires ALB. Configure terminateAfterMinutes to keep the old task set alive during validation.
  • Canary: Use CodeDeploy with CodeDeployDefault.ECSCanary10Percent5Minutes for high-risk changes.
  • Circuit breaker: Always enable deploymentCircuitBreaker with rollback: true to auto-rollback failed deployments.

Provisioning

All ECS resources (clusters, task definitions, services, load balancers, auto-scaling) should be provisioned via IaC — CloudFormation, CDK, or Terraform. Never create or mutate infrastructure with imperative CLI commands. Use the cdk-docs or cloudformation-docs MCP tools for current resource properties.

Observability & Debugging CLI

CLI usage should be limited to read-only operations, observability, and interactive debugging:

# Describe cluster status
aws ecs describe-clusters --clusters my-cluster --include STATISTICS ATTACHMENTS

# List services in a cluster
aws ecs list-services --cluster my-cluster

# Describe a service (deployment status, events, task counts)
aws ecs describe-services --cluster my-cluster --services my-svc

# List running tasks
aws ecs list-tasks --cluster my-cluster --service-name my-svc --desired-status RUNNING

# Describe a task (container status, stopped reason, network)
aws ecs describe-tasks --cluster my-cluster --tasks <task-id>

# Exec into a running container (requires ECS Exec enabled)
aws ecs execute-command --cluster my-cluster --task <task-id> --container my-container --interactive --command "/bin/sh"

# Tail logs
aws logs tail /ecs/my-task --follow

# Describe task definition (inspect current config)
aws ecs describe-task-definition --task-definition my-task

# Check service events for deployment issues
aws ecs describe-services --cluster my-cluster --services my-svc --query "services[].events[:5]"

Output Format

FieldDetails
Service nameECS service name and cluster
Launch typeFargate, Fargate Spot, EC2, or External
Task CPU/MemoryvCPU and memory allocation (e.g., 0.5 vCPU / 1 GB)
Desired countNumber of tasks, min/max for auto-scaling
Deployment strategyRolling update, Blue/Green (CodeDeploy), or Canary
Load balancerALB or NLB, target group health check config
Auto-scalingScaling metric, target value, min/max capacity
LoggingLog driver, log group, retention period

Related Skills

  • eks — Kubernetes-based alternative to ECS for container orchestration
  • ec2 — EC2 launch type compute, instance selection, and Spot strategy
  • networking — VPC, subnet, and security group design for ECS tasks
  • iam — Task execution roles and task roles for least-privilege access
  • cloudfront — CDN in front of ECS-backed services
  • observability — CloudWatch Container Insights, alarms, and dashboards

Anti-Patterns

  • Using :latest tag in production: Always use immutable image tags (git SHA or semantic version). :latest makes rollbacks impossible and deployments non-deterministic.
  • One giant cluster per account: Use separate clusters per environment (dev/staging/prod) or per team. Cluster-level IAM and capacity provider strategies are easier to manage.
  • Oversized task definitions: Right-size CPU and memory. A 4 vCPU / 8 GB task running at 10% utilization is burning money. Start small, scale up based on CloudWatch Container Insights metrics.
  • Skipping health checks: Always define container health checks in the task definition AND target group health checks. Without both, ECS cannot detect unhealthy tasks.
  • Ignoring ECS Exec: Enable ExecuteCommandConfiguration on the cluster and enableExecuteCommand on the service. It replaces SSH access to containers and is essential for debugging.
  • No deployment circuit breaker: Without it, a bad deployment will keep cycling failing tasks indefinitely, consuming capacity and generating noise.
  • Putting secrets in environment variables: Use the secrets field with Secrets Manager or SSM Parameter Store references. Environment variables are visible in the console and API.
  • Running as root: Set user in the task definition to a non-root user. Combine with readonlyRootFilesystem for defense in depth.

Additional Resources

Reference Files

For detailed documentation and decision guidance, consult:

  • `references/express-mode.md` — Full Express Mode pros/cons, defaults table, IAM roles, CLI commands, resource sharing details, Express Mode vs standard ECS decision matrix, and official AWS documentation links

Related skills

FAQ

Should I use Fargate or EC2 for ECS?

Default to Fargate unless you need GPUs, sustained high utilization where price matters, specific instance types, or host-level access.

What is ECS Express Mode?

It deploys a production-ready, load-balanced Fargate service from a single API call and is AWS's recommended App Runner replacement, which closes to new customers April 30, 2026.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.