Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)48k · #3859

aws-ecs-fargate

Skill này làm gì

Công cụ này giúp bạn chạy ứng dụng (chạy trong “container”, giống các hộp biệt lập) trên đám mây của Amazon. Nó quản lý toàn bộ hạ tầng để bạn không phải lo về máy chủ.

Khi nào nên dùng

  • ✓Khi bạn muốn chạy một ứng dụng trên đám mây mà không phải quản lý máy chủ.
  • ✓Khi bạn muốn nhiều “container” giao tiếp với nhau và nhận lưu lượng truy cập.
  • ✓Khi bạn cập nhật ứng dụng và cần đảm bảo nó vẫn sẵn sàng trong lúc chuyển đổi.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-ecs-fargate/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-ecs-fargate/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Triển khai ứng dụng web của tôi trong container trên AWS để có thể truy cập từ internet.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn mô tả cách ứng dụng nên chạy trong một tệp cấu hình. Công cụ dùng tệp này để tạo và quản lý các “container” trên AWS, xử lý mọi thứ tự động.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

AWS ECS & Fargate

Run containerized applications on Amazon ECS with Fargate serverless compute or EC2 launch type.

When to Use This Skill

  • Deploying Docker containers to AWS without managing servers (Fargate)
  • Running microservices with service discovery and load balancing
  • Setting up blue/green or rolling deployments for containerized apps
  • Configuring auto-scaling for container workloads
  • Migrating from docker-compose or Kubernetes to ECS
  • Troubleshooting task failures, health check issues, or networking problems

Prerequisites

  • AWS CLI v2 installed and configured
  • Docker installed for building and pushing images
  • IAM permissions: ecs:*, ecr:*, elasticloadbalancing:*, logs:*, iam:PassRole
  • An ECR repository for storing container images
  • A VPC with subnets and an ALB (see aws-vpc (aws-vpc))

Cluster Setup

# Create an ECS cluster with Container Insights enabled
aws ecs create-cluster \
  --cluster-name production \
  --capacity-providers FARGATE FARGATE_SPOT \
  --default-capacity-provider-strategy '[
    {"capacityProvider": "FARGATE", "weight": 1, "base": 2},
    {"capacityProvider": "FARGATE_SPOT", "weight": 3}
  ]' \
  --settings '[{"name": "containerInsights", "value": "enabled"}]'

# List clusters
aws ecs list-clusters

# Describe cluster details
aws ecs describe-clusters --clusters production --include STATISTICS ATTACHMENTS

Push Image to ECR

# Create ECR repository
aws ecr create-repository \
  --repository-name myapp \
  --image-scanning-configuration scanOnPush=true \
  --encryption-configuration encryptionType=KMS

# Authenticate Docker to ECR
aws ecr get-login-password --region us-east-1 | \
  docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com

# Build, tag, and push
docker build -t myapp:latest .
docker tag myapp:latest 123456789012.dkr.ecr.us-east-1.amazonaws.com/myapp:latest
docker push 123456789012.dkr.ecr.us-east-1.amazonaws.com/myapp:latest

Task Definition

{
  "family": "myapp",
  "networkMode": "awsvpc",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "512",
  "memory": "1024",
  "executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
  "taskRoleArn": "arn:aws:iam::123456789012:role/ecsTaskRole",
  "containerDefinitions": [
    {
      "name": "myapp",
      "image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/myapp:latest",
      "essential": true,
      "portMappings": [
        {
          "containerPort": 8080,
          "protocol": "tcp"
        }
      ],
      "environment": [
        {"name": "NODE_ENV", "value": "production"},
        {"name": "PORT", "value": "8080"}
      ],
      "secrets": [
        {
          "name": "DB_PASSWORD",
          "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:myapp/db-password"
        },
        {
          "name": "API_KEY",
          "valueFrom": "arn:aws:ssm:us-east-1:123456789012:parameter/myapp/api-key"
        }
      ],
      "healthCheck": {
        "command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
        "interval": 30,
        "timeout": 5,
        "retries": 3,
        "startPeriod": 60
      },
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/myapp",
          "awslogs-region": "us-east-1",
          "awslogs-stream-prefix": "ecs",
          "awslogs-create-group": "true"
        }
      },
      "ulimits": [
        {"name": "nofile", "softLimit": 65536, "hardLimit": 65536}
      ]
    }
  ]
}
# Register the task definition
aws ecs register-task-definition --cli-input-json file://task-definition.json

# List task definition revisions
aws ecs list-task-definitions --family-prefix myapp

# Deregister an old revision
aws ecs deregister-task-definition --task-definition myapp:1

Create Service with ALB

# Create the CloudWatch log group first
aws logs create-log-group --log-group-name /ecs/myapp
aws logs put-retention-policy --log-group-name /ecs/myapp --retention-in-days 30

# Create ECS service with load balancer
aws ecs create-service \
  --cluster production \
  --service-name myapp \
  --task-definition myapp:2 \
  --desired-count 3 \
  --launch-type FARGATE \
  --platform-version LATEST \
  --deployment-configuration '{
    "deploymentCircuitBreaker": {"enable": true, "rollback": true},
    "maximumPercent": 200,
    "minimumHealthyPercent": 100
  }' \

…
Câu hỏi thường gặp

“Container” là gì?

Hãy coi container như một hộp tiêu chuẩn chứa mọi thứ ứng dụng cần để chạy: mã, thư viện và thiết lập. Điều này đảm bảo ứng dụng hoạt động giống nhau ở mọi nơi.

AWS ECS và Fargate là gì?

AWS ECS là dịch vụ giúp quản lý container. Fargate là cách dùng ECS mà không cần lo về máy chủ nơi container chạy; AWS tự lo việc đó cho bạn.

Tôi có cần biết lập trình để dùng công cụ này không?

Hiểu biết cơ bản về lập trình và đám mây sẽ có ích, nhưng công cụ được thiết kế để đơn giản hóa quy trình, kể cả với người không chuyên.

Chi tiết

Mô tả gốc của tác giả

Deploy containers on ECS and Fargate. Configure task definitions, services, and load balancing. Use when running containerized workloads on AWS.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#3859
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự