Skip to main content
友田 陽大

Category

AWS ECS on Fargate 本番運用ガイド(タスク設計/ネットワーキング/CI・Blue/Green/オートスケール/コスト最適化/トラブルシュート/技術選定)

ECS on Fargateは『サーバー管理という最大のコスト(人件費)を消し、本番品質そのものに集中する』ためのサーバーレス・コンテナ基盤です。本クラスタは、ECS on Fargateを採用した後の『どう本番で作るか』に集中します——CPU/メモリの固定ペアと分離境界を踏まえたタスク設計、awsvpc・ALB(target type=ip)・Service Connect・VPCエンドポイントのネットワーク設計、ローリング更新+サーキットブレーカーによる自動ロールバックとネイティブBlue/Green(bake time)・CodeDeploy・GitHub Actions(OIDC)の安全な出荷、Application Auto Scalingのターゲット追跡とSQSバックログ・パー・タスクによるワーカーのスケール、料金モデルの理解からGraviton・Fargate Spot・Compute Savings Plansへ至るコスト最適化、停止理由コード別のトラブルシュート、そしてLambda/App Runnerとの技術選定まで——可観測性・回復性・冪等性・グレースフルシャットダウン・セキュリティ・コスト効率を軸に体系化します。木材流通B2B SaaS(API Gateway→NLB→ALB→ECSで221エンドポイント)と本番二重課金0件の決済基盤をFargateで運用した知見を根拠に、AWS公式ドキュメントに忠実な実コードで解説します。ECSかEKSかの技術選定そのものは『インフラ・IaC・CI/CD』クラスタの『ECS vs EKS』を参照してください。

7 articles in total

Foundational guide

Foundational guide (start here)

AWS
ECS
Fargate
コンテナ
Terraform

AWS ECS on Fargate Production Operation Guide: Designing, Deploying, Costing, and Securing Serverless Containers in Real Code

An ECS on Fargate production operation guide faithful to the AWS official documentation. Systematizes, with Terraform, task-definition JSON, and real code: task-size design (the CPU/memory table), awsvpc networking, rolling updates + deployment circuit breaker, graceful shutdown via SIGTERM, separation of the execution role and the task role, and Fargate Spot and cost optimization.

22 min read

Related practical articles