Token导航 LogoToken导航TokenDH.com
运维和基础设施需要联网github未标认证来源可访问clear审计通过

ecs-fargateECS 法门

Agent Skill

ecs-fargate 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

380

周安装

16

GitHub Stars

9

下载量

133
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ecs-fargate(ECS 法门)
来源仓库:https://github.com/adaptationio/skrillz
仓库路径:skills/ecs-fargate
安装命令:
npx skills add https://github.com/adaptationio/skrillz --skill ecs-fargate
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/adaptationio/skrillz --skill ecs-fargate

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,支持围绕仓库状态进行整理。

  • 适合在需要分析代码变更、协作事项或项目进展时使用。
  • 可通过原始 README 和安装命令进一步核验具体功能和使用场景。
  • 安装方式:通过 npx skills add 命令从指定 GitHub 仓库安装。
  • 建议确认权限范围、维护状态及是否触发联网、命令执行或文件读写。

SKILL.md

AWS Fargate for ECS

Complete guide to AWS Fargate serverless container compute, including sizing, optimization, and best practices.

Quick Reference

AspectFargateEC2
ManagementServerlessManual
ScalingAutomaticASG-based
PricingPer vCPU-secondPer instance-hour
OverheadNoneHigh
ControlLimitedFull
Best ForVariable loadSteady state

When to Use Fargate

Use Fargate when:

  • Team prioritizes operational simplicity
  • Variable or unpredictable traffic
  • Microservices architecture
  • Rapid scaling needed
  • Development/testing environments
  • No specific instance type requirements

Use EC2 when:

  • Steady-state, predictable workloads
  • Cost optimization is critical (>60% utilization)
  • Need specific instance types (GPU, high memory)
  • Existing Reserved Instance commitments
  • Custom AMI requirements

CPU and Memory Configurations

Valid Combinations

CPU (vCPU)Memory Options
0.25512 MB, 1 GB, 2 GB
0.51 GB - 4 GB (1 GB increments)
12 GB - 8 GB (1 GB increments)
24 GB - 16 GB (1 GB increments)
48 GB - 30 GB (1 GB increments)
816 GB - 60 GB (4 GB increments)
1632 GB - 120 GB (8 GB increments)

Sizing Guidelines

# Sizing decision tree
def recommend_fargate_size(app_type: str, expected_memory_mb: int):
    """Recommend Fargate CPU/Memory based on workload"""

    if app_type == "web_api":
        # Typically CPU-bound
        if expected_memory_mb <= 512:
            return {"cpu": "256", "memory": "512"}
        elif expected_memory_mb <= 1024:
            return {"cpu": "512", "memory": "1024"}
        else:
            return {"cpu": "1024", "memory": str(min(expected_memory_mb, 2048))}

    elif app_type == "worker":
        # Typically memory-bound
        return {"cpu": "256", "memory": str(max(512, expected_memory_mb))}

    elif app_type == "batch":
        # Need burst capacity
        return {"cpu": "1024", "memory": str(max(2048, expected_memory_mb))}

    # Default conservative
    return {"cpu": "512", "memory": "1024"}

Cost-Effective Sizing

# Development: Minimum viable
cpu    = "256"
memory = "512"

# Small API: Balanced
cpu    = "512"
memory = "1024"

# Production API: Standard
cpu    = "1024"
memory = "2048"

# Memory-intensive: Data processing
cpu    = "1024"
memory = "4096"

# Compute-intensive: ML inference
cpu    = "4096"
memory = "8192"

Platform Versions

Current Versions (2025)

VersionStatusFeatures
1.4.0Recommendedcontainerd runtime, jumbo frames, UDP support
1.3.0Deprecated (Mar 2026)Docker runtime
LATESTAuto-updatesAlways latest revision

Configuration

# Always pin explicitly
resource "aws_ecs_service" "app" {
  platform_version = "1.4.0"  # NOT "LATEST"
  # ...
}
# Boto3
ecs.create_service(
    platformVersion='1.4.0',
    # ...
)

Fargate Spot (Cost Optimization)

Overview

  • Up to 70% savings vs on-demand
  • 2-minute termination notice when capacity needed
  • Best for: Batch jobs, CI/CD, fault-tolerant workloads

Configuration

# Mixed strategy: reliable baseline + cost-effective scaling
resource "aws_ecs_service" "app" {
  capacity_provider_strategy {
    capacity_provider = "FARGATE"
    weight            = 1
    base              = 2  # Always keep 2 on-demand
  }

  capacity_provider_strategy {
    capacity_provider = "FARGATE_SPOT"
    weight            = 4  # 4x weight = ~80% on Spot
  }
}
# Boto3
ecs.create_service(
    capacityProviderStrategy=[
        {'capacityProvider': 'FARGATE', 'weight': 1, 'base': 2},
        {'capacityProvider': 'FARGATE_SPOT', 'weight': 4}
    ],
    # ...
)

Handling Spot Interruptions

# Application-level graceful shutdown
import signal
import sys

def shutdown_handler(signum, frame):
    print("Received termination signal, shutting down gracefully...")
    # Drain connections
    # Complete in-flight requests
    # Save state if needed
    sys.exit(0)

signal.signal(signal.SIGTERM, shutdown_handler)

ARM/Graviton (20% Cost Savings)

Benefits

  • ~20% cost reduction vs x86
  • Up to 40% better performance for many workloads
  • Same API - just change task definition

Configuration

resource "aws_ecs_task_definition" "app" {
  family                   = "my-app"
  requires_compatibilities = ["FARGATE"]

  # ARM architecture
  runtime_platform {
    operating_system_family = "LINUX"
    cpu_architecture        = "ARM64"  # or "X86_64"
  }

  # ...
}

Multi-Architecture Images

# Dockerfile supporting both architectures
FROM --platform=$TARGETPLATFORM python:3.11-slim

# Build for multiple platforms
# docker buildx build --platform linux/amd64,linux/arm64 -t myapp:latest .
# Build and push multi-arch image
docker buildx create --use
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --push \
  -t 123456789.dkr.ecr.us-east-1.amazonaws.com/myapp:latest .

Networking (awsvpc Mode)

Task-Level Networking

Each Fargate task gets its own ENI with:

  • Unique private IP
  • Dedicated security group
  • Full network isolation
resource "aws_ecs_service" "app" {
  network_configuration {
    subnets          = var.private_subnets
    security_groups  = [aws_security_group.ecs_tasks.id]
    assign_public_ip = false  # Use NAT for outbound
  }
}

VPC Endpoints (Recommended)

# Avoid NAT costs for AWS services
resource "aws_vpc_endpoint" "ecr_api" {
  vpc_id            = module.vpc.vpc_id
  service_name      = "com.amazonaws.${var.region}.ecr.api"
  vpc_endpoint_type = "Interface"
  subnet_ids        = module.vpc.private_subnets
}

resource "aws_vpc_endpoint" "ecr_dkr" {
  vpc_id            = module.vpc.vpc_id
  service_name      = "com.amazonaws.${var.region}.ecr.dkr"
  vpc_endpoint_type = "Interface"
  subnet_ids        = module.vpc.private_subnets
}

resource "aws_vpc_endpoint" "s3" {
  vpc_id       = module.vpc.vpc_id
  service_name = "com.amazonaws.${var.region}.s3"
}

resource "aws_vpc_endpoint" "logs" {
  vpc_id            = module.vpc.vpc_id
  service_name      = "com.amazonaws.${var.region}.logs"
  vpc_endpoint_type = "Interface"
  subnet_ids        = module.vpc.private_subnets
}

EFS Integration (Persistent Storage)

Configuration

# EFS File System
resource "aws_efs_file_system" "app" {
  creation_token = "app-storage"
  encrypted      = true

  lifecycle_policy {
    transition_to_ia = "AFTER_30_DAYS"
  }
}

resource "aws_efs_mount_target" "app" {
  count           = length(var.private_subnets)
  file_system_id  = aws_efs_file_system.app.id
  subnet_id       = var.private_subnets[count.index]
  security_groups = [aws_security_group.efs.id]
}

# Task Definition with EFS
resource "aws_ecs_task_definition" "app" {
  family = "my-app"

  volume {
    name = "app-storage"

    efs_volume_configuration {
      file_system_id          = aws_efs_file_system.app.id
      root_directory          = "/app-data"
      transit_encryption      = "ENABLED"
      authorization_config {
        access_point_id = aws_efs_access_point.app.id
        iam             = "ENABLED"
      }
    }
  }

  container_definitions = jsonencode([
    {
      name = "my-app"
      mountPoints = [
        {
          sourceVolume  = "app-storage"
          containerPath = "/data"
          readOnly      = false
        }
      ]
      # ...
    }
  ])
}

Ephemeral Storage

Default and Configurable

# Default: 20 GB, configurable up to 200 GB
resource "aws_ecs_task_definition" "app" {
  ephemeral_storage {
    size_in_gib = 100  # For large temp files
  }
}

Cost Optimization Summary

StrategySavingsEffort
Fargate Spot70%Low
ARM/Graviton20%Medium
Right-sizing10-50%Medium
Compute Savings Plans50%Low
Schedule-based scaling30-60%Medium

Cost Calculation

def estimate_monthly_cost(cpu_vcpu: float, memory_gb: float,
                          hours_per_month: int = 730,
                          spot_percentage: float = 0.0):
    """Estimate monthly Fargate cost (us-east-1 pricing)"""

    # On-demand pricing (approximate)
    cpu_rate = 0.04048  # per vCPU-hour
    memory_rate = 0.004445  # per GB-hour

    on_demand_hours = hours_per_month * (1 - spot_percentage)
    spot_hours = hours_per_month * spot_percentage

    # Spot is ~70% cheaper
    cpu_cost = (cpu_vcpu * cpu_rate * on_demand_hours) + \
               (cpu_vcpu * cpu_rate * 0.3 * spot_hours)
    memory_cost = (memory_gb * memory_rate * on_demand_hours) + \
                  (memory_gb * memory_rate * 0.3 * spot_hours)

    return cpu_cost + memory_cost

# Example: 1 vCPU, 2 GB, 50% Spot
cost = estimate_monthly_cost(1, 2, spot_percentage=0.5)
print(f"Estimated monthly cost: ${cost:.2f}")  # ~$25

Progressive Disclosure

Quick Start (This File)

  • Fargate vs EC2 decision
  • CPU/Memory sizing
  • Platform versions
  • Cost optimization basics

Detailed References

Related Skills

  • boto3-ecs: SDK patterns for ECS
  • terraform-ecs: Infrastructure as Code
  • ecs-deployment: Deployment strategies
  • ecs-troubleshooting: Debugging guide

Best Practices

  1. Start small, scale up - Begin with 0.25 vCPU/512 MB and increase based on metrics
  2. Use Fargate Spot for non-critical workloads (70% savings)
  3. Consider ARM/Graviton for compatible workloads (20% savings)
  4. Pin platform version explicitly (e.g., "1.4.0")
  5. Use VPC endpoints to reduce NAT costs
  6. Enable Container Insights for visibility
  7. Right-size continuously using CloudWatch metrics
  8. Use capacity provider strategy instead of launch type

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

github-copilot

28.22%
按下载量换算38

Claude Code

23.49%
按下载量换算31

mcpjam

17.56%
按下载量换算23

moltbot

11.79%
按下载量换算16

windsurf

8.66%
按下载量换算12

zencoder

3.51%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills