Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Operating ECS in production
Search
Michael Wittig
April 12, 2018
Technology
0
63
Operating ECS in production
https://github.com/widdix/aws-cf-templates
Michael Wittig
April 12, 2018
Tweet
Share
More Decks by Michael Wittig
See All by Michael Wittig
AWS Cost Optimization 101
michaelwittig
0
68
DVC02 - Cutting-edge architectures based on AWS AppSync, Lambda, and Fargate
michaelwittig
0
95
Review: AWS Global Accelerator - AWS Meetup Stuttgart 2019
michaelwittig
0
390
Rapid Docker on AWS
michaelwittig
0
80
Serverless Workflows with AWS Step Functions
michaelwittig
0
52
Your Lambda function might execute twice. Be prepared! (ServerlessDays Zurich)
michaelwittig
0
59
Cutting-Edge Architectures Based on AppSync, Lambda, and Fargate
michaelwittig
1
510
Your Lambda function might execute twice. Be prepared!
michaelwittig
0
700
Network Security on AWS
michaelwittig
0
59
Other Decks in Technology
See All in Technology
OAuth/OpenID Connectで実現するMCPのセキュアなアクセス管理
kuralab
5
560
CIでのgolangci-lintの実行を約90%削減した話
kazukihayase
0
320
白金鉱業Meetup_Vol.19_PoCはデモで語れ!顧客の本音とインサイトを引き出すソリューション構築
brainpadpr
2
440
Rubyで作る論理回路シミュレータの設計の話 - Kashiwa.rb #12
kozy4324
1
320
型システムを知りたい人のための型検査器作成入門
mame
15
3.9k
上長や社内ステークホルダーに対する解像度を上げて、より良い補完関係を築く方法 / How-to-increase-resolution-and-build-better-complementary-relationships-with-your-bosses-and-internal-stakeholders
madoxten
13
7.9k
自分を理解するAI時代の準備 〜マイプロフィールMCPの実装〜
edo_m18
0
110
DB 醬,嗨!哪泥嘎斯基?
line_developers_tw
PRO
0
270
AWS と定理証明 〜ポリシー言語 Cedar 開発の舞台裏〜 #fp_matsuri / FP Matsuri 2025
ytaka23
9
2.6k
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
150
初めてのAzure FunctionsをClaude Codeで作ってみた / My first Azure Functions using Claude Code
hideakiaoyagi
1
120
Securing your Lambda 101
chillzprezi
0
300
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
Side Projects
sachag
455
42k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Cult of Friendly URLs
andyhume
79
6.4k
How GitHub (no longer) Works
holman
314
140k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
930
Making Projects Easy
brettharned
116
6.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Being A Developer After 40
akosma
90
590k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Transcript
https://github.com/widdix/aws-cf-templates Operating ECS in production
Hello! I am Michael Wittig AWS in Action (2nd ed)
cloudonaut.io AWS Community Hero Independent AWS Consultant Twitter @hellomichibye 2
ECS Orchestrates Docker containers for you Manages Network and per
Task Security 3
ECS Cluster 4 ECS Cluster ECS Instance = EC2 Instance
running ecs-agent ECS optimized AMI ECS Instance ECS Instance
Task Definition 5 ECS Cluster aws ecs run-task \ --count
2 Task Definition Image ... ECS Task 1..N Container ECS Task 1..N Container
ECS Scheduling 6 ECS Cluster ECS Instance ECS Instance ECS
Instance ECS Task 1..N Container ECS Task 1..N Container Placement constraints and strategies
ECS Networking ◎ Public/Private Load Balancer ◎ Elastic Network Interface
(ENI) per task ◦ Public IP ◦ Private IP ◦ Per Task Security Group 7
ECS Service 8 ECS Cluster Task Definition ECS Task ECS
Task ECS Service ◎ Observer ◎ ENI ◎ Load Balancer ◎ Deployment
Operating ECS Challenges 9
1. Spinning up a cluster 10 Demo
Fault Tolerant Auto Scaling Group, Availability Zones 11 Demo
2. Updating a cluster New ECS optimized AMIs are released
frequently! 12
Rolling Update CloudFormation replaces EC2 instances in Auto Scaling Groups
in small batches. 13 Demo
But what about inflight requests? 14
Instance Draining Move all tasks from ECS instance before Instance
is terminated. 15 Demo
Implementing Instance Draining ◎ Auto Scaling Lifecycle hook ◦ Drain
Instance ◦ Wait until drained ◦ Complete Lifecycle hook 16
Tasks are not rescheduled once places! Your last batch of
ECS instances will end up with 0 tasks! 17
3. Scaling a cluster Or adding/removing EC2 instances. 18 Demo
We don’t know how many tasks we can schedule! 19
20 ECS Cluster Available: CPU 100 Memory 200 Available: CPU
100 Memory 200 Available: CPU 100 Memory 200 Available: CPU 300 Memory 600 Task CPU 200 Memory 200
Schedulable Containers 1. Define largest possible task (CPU/memory) 2. For
each instance: a. Calculate how many largest possible tasks would fit b. Report to CloudWatch 3. Scale based on the sum of this metric 21 Credits http://garbe.io/blog/2017/04/12/a-better-solution-to-ecs-autoscaling/
22 ECS Cluster Available: CPU 100 Memory 200 Schedulable 0
Available: CPU 100 Memory 200 Schedulable 0 Available: CPU 100 Memory 200 Schedulable 0 Available: CPU 300 Memory 600 Schedulable 0 Largest Task CPU 200 Memory 200
No CloudWatch Events emitted when task launch failed due to
capacity shortage. 23
4. Public load balancing 24
Public load balancing 25 ECS Cluster ECS Instance ECS Instance
ECS Task 1..N Container ECS Task 1..N Container ECS Task 1..N Container Load Balancer (ALB) ◎ Path based ◎ Host based DNS
5. Internal service discovery / load balancing 26
Internal load balancing 27 ECS Task Frontend LB (internet-facing) ECS
Task ECS Task Catalog (internal) ECS Task ECS Task Shopping card (internal) ECS Task ECS Task DNS DNS DNS
Catalog Catalog Internal Route 53 (with per task ENI) 28
ECS Task Frontend LB (internet-facing) ECS Task ECS Task ECS Task ECS Task ECS Task ECS Task DNS DNS DNS
6. Logging & Monitoring CloudWatch. 29
Credits Special thanks to all the people who made and
released these awesome resources for free: ◎ Presentation template by SlidesCarnival ◎ Photographs by Pexels 30
Thanks! http://bit.ly/amazon-web-services-in-action-2nd-edition https://github.com/widdix/aws-cf-templates https://cloudonaut.io Twitter @hellomichibye Mail
[email protected]
31