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
61
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
62
DVC02 - Cutting-edge architectures based on AWS AppSync, Lambda, and Fargate
michaelwittig
0
88
Review: AWS Global Accelerator - AWS Meetup Stuttgart 2019
michaelwittig
0
370
Rapid Docker on AWS
michaelwittig
0
75
Serverless Workflows with AWS Step Functions
michaelwittig
0
47
Your Lambda function might execute twice. Be prepared! (ServerlessDays Zurich)
michaelwittig
0
57
Cutting-Edge Architectures Based on AppSync, Lambda, and Fargate
michaelwittig
1
500
Your Lambda function might execute twice. Be prepared!
michaelwittig
0
680
Network Security on AWS
michaelwittig
0
52
Other Decks in Technology
See All in Technology
バクラクの認証基盤の成長と現在地 / bakuraku-authn-platform
convto
4
650
「経験の点」の位置を意識したキャリア形成 / Career development with an awareness of the “point of experience” position
pauli
4
100
Amazon CloudWatch Application Signals ではじめるバーンレートアラーム / Burn rate alarm with Amazon CloudWatch Application Signals
ymotongpoo
5
540
Web Intelligence and Visual Media Analytics
weblyzard
PRO
1
5.8k
The Tale of Leo: Brave Lion and Curious Little Bug
canalun
1
130
Рекомендации с нуля: как мы в Lamoda превратили главную страницу в ключевую точку входа для персонализированного шоппинга. Данил Комаров, Data Scientist, Lamoda Tech
lamodatech
0
770
Devinで模索する AIファースト開発〜ゼロベースから始めるDevOpsの進化〜
potix2
PRO
8
3.5k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
0
210
AIエージェント開発手法と業務導入のプラクティス
ykosaka
5
1.6k
白金鉱業Meetup_Vol.18_AIエージェント時代のUI/UX設計
brainpadpr
1
180
ブラウザのレガシー・独自機能を愛でる-Firefoxの脆弱性4選- / Browser Crash Club #1
masatokinugawa
1
500
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
130
Featured
See All Featured
For a Future-Friendly Web
brad_frost
176
9.7k
Fireside Chat
paigeccino
37
3.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Code Review Best Practice
trishagee
67
18k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Facilitating Awesome Meetings
lara
54
6.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
2.9k
Speed Design
sergeychernyshev
29
900
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.7k
Automating Front-end Workflow
addyosmani
1369
200k
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 michael@widdix.de 31