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
コンテナをSpot Fleetで起動するという選択肢
Search
Kazuma Watanabe
December 14, 2016
Technology
2
1k
コンテナをSpot Fleetで起動するという選択肢
JAWS-UG コンテナ支部 #7
Kazuma Watanabe
December 14, 2016
Tweet
Share
More Decks by Kazuma Watanabe
See All by Kazuma Watanabe
SmartHRにおけるBiTemporal Data Modelの実践のその後 / After the practice of BiTemporal Data Model in SmartHR
wata727
1
2.5k
PHPを検査するPHPを書く / Write PHP inspection by PHP
wata727
1
2.1k
快適なコードレビューを目指して / For a comfortable code review
wata727
1
600
現実世界でのコンテナの運び方
wata727
3
1.1k
Lintの付き合い方とPahoutのご紹介
wata727
0
150
Querlyで始めるコードレビューの自動化
wata727
2
440
エンジニア向けSaaSを支えるInfrastructure as Code
wata727
5
2.3k
SideCIのインフラ構築を自動化した話
wata727
1
2.1k
Other Decks in Technology
See All in Technology
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
280
怖くない!ゼロから始めるPHPソースコードコンパイル入門
colopl
0
170
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
140
Wantedly での Datadog 活用事例
bgpat
2
700
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
120
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
3
280
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
生成AIのガバナンスの全体像と現実解
fnifni
1
210
DevFest 2024 Incheon / Songdo - Compose UI 조합 심화
wisemuji
0
160
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
140
コンテナセキュリティのためのLandlock入門
nullpo_head
2
330
ハイテク休憩
sat
PRO
2
180
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
A better future with KSS
kneath
238
17k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Making Projects Easy
brettharned
116
6k
A Modern Web Designer's Workflow
chriscoyier
693
190k
How to Ace a Technical Interview
jacobian
276
23k
Scaling GitHub
holman
459
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
RailsConf 2023
tenderlove
29
940
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Transcript
ίϯςφΛSpot FleetͰ ্ཱͪ͛Δͱ͍͏બࢶ JAWS-UG ίϯςφࢧ෦ #7 @wata727
@wata727 • Kazuma Watanabe • Engineer in Actcat, Inc. •
AWS Solution Architect • https://twitter.com/wata727_
Containers in SideCI
Sandbox Containers • ࣮ߦڥΛίϯςφԽ͙ͯ͢͠ഁغ͢Δ • 5,000 containers / day EPDLFS
Ubuntu Host GitHub Clone Comment
Sandbox Containers • ࣮ߦڥΛίϯςφԽ͙ͯ͢͠ഁغ͢Δ • 5,000 containers / day EPDLFS
Ubuntu Host GitHub Clone Comment
Spot Fleet ?
εϙοτΠϯελϯεΛ ຊ൪ͰͬͯΔํʁ ʢ༧: 10%ʣ ※ه: 5%͘Β͍Ͱͨ͠
Amazon Spot Instance • ༧උͷEC2ίϯϐϡʔςΟϯάੑೳʹೖࡳ • ͓͍҆ʂʂʂ • ͱ͋Δc4.2xlargeͷྫ: $0.39
→ $0.06 ڻ͖ͷ
ͨͩ͠… • ೖࡳՁ֨ΛԼճΔͱམͪΔ • ߴ͘ͳͬͨΒผͷϓʔϧʢAZͱΠϯελϯε λΠϓͷΈ߹ΘͤʣͷεϙοτΠϯελϯ εΛىಈ͢Δ is ͍͠ •
ͦΜͳʹ͍ͳ͍͔…
Spot Fleet • εϙοτΠϯελϯεͷλʔήοτ༰ྔΛҡ ࣋͢ΔͨΊͷΈ • Ճྉۚແ͠ • ஈ͕ߴಅͨ͠ΒɺผͷϓʔϧͰҰ൪͍҆ε ϙοτΠϯελϯε͕ࣗಈͰ্ཱ͕ͪΔ
Spot Fleetͷઓུ • lowest: બͨ͠தͰৗʹҰ൪͍҆ϓʔϧ͔Β ىಈ͢Δɺ͍͕҆ߴಅ͢Δͱશ෦མͪΔ • diversified: ՄೳͳݶΓϓʔϧΛࢄͭͭ͠ɺ ͍҆ॱʹىಈ͢Δɺߴ͍ͱ͖͋Δ͕ɺ
Խͱߴಅ࣌ͷϦεΫܰݮ͕ظͰ͖Δ
͡Ί͔ͨ • ެࣜͷνϡʔτϦΞϧ͕͔ͳΓஸೡͳͷͰɺ ͦΕʹैͬͯ࡞ͬͯΈΔͱྑͦ͞͏ • ͦΕ͢Β໘ͳਓ • https://github.com/wata727/ tf_aws_ecs_on_spotfleet
Demo
Spot Fleet in SideCI
EC2ΛSpot Fleetʹ͠·ͨ͠
Spot Fleetʹ͢ΔͨΊʹ • ಥવΠϯελϯε͕མͪͯࠔΒͳ͍Α͏ʹ ઃܭ͢ΔʢϦτϥΠͱ͔ʣ • ىಈͨ͠Βɺ͙͢ʹαʔϏεΠϯͰ͖ΔΑ͏ ʹϢʔβσʔλͱ͔ઃఆ͓ͯ͘͠ • େମAutoScalingʹඞཁͳͷͱಉ͡ɺඞવత
ʹোʹڧ͍ઃܭʹͳΔ
҆ఆͯ͠Քಇͤ͞ΔͨΊͷTips • diversifiedͱlowestͰ͚Δ
҆ఆͯ͠Քಇͤ͞ΔͨΊͷTips • Spot Fleet ؒͷೖࡳՁ֨ʹࠩΛ͚ͭΔ • ೖࡳՁ֨Λ͑ͨ࣌ͰผͷҰ൪͍҆ϓʔϧ ͔ΒΠϯελϯε͕ىಈ͢Δ͜ͱΛར༻͢Δ • ೖࡳՁ͕͚֨҆ΕɺఆظతʹҰ൪͍҆Πϯ
ελϯεϓʔϧͷ࠶ׂΓ͕ͯߦΘΕΔ
Ձ֨҆ͨ͘͠Β͙͢མͪͳ͍ʁ • EC2ͷ՝ۚ୯Ґ1࣌ؒ͝ͱ͔ͩΒɺִ͍ؒ Ͱ࠶ىಈͨ͠Β༨ܭʹߴ͘ͳΔΜ͡Ό… • ࣮ىಈ1࣌ؒҎʹεϙοτՁ֨ͷߴಅͰڧ ੍λʔϛωʔτ͞Εͨ߹ର֎ʹͳΔ • http://aws.typepad.com/sajp/2016/11/aws- black-belt-online-seminar-amazon-ec2-spot-
instances.html
Ͱɺ҆ఆͯ͠·͔͢ʁ • ҙ֎ͱ҆ఆͯ͠·͢ • 2िؒ͘Β͍ฏؾͰੜ͖ͬͯΔΠϯελϯε ͞Μ͍·ͨ͠
ͱ͋Δm4.2xlargeͷ1
Spot Fleet ӡ༻Ͱ ϋϚͬͨ͜ͱ
ಥવͷىಈΤϥʔ • Spot FleetͰΠϯελϯε͕ىಈ͠ͳ͘ͳͬͨ • VPCͰIPΞυϨε͕֬อͰ͖ͯͳ͍…ʁ • ͦΜͳഅࣛͳͱࢥ͍ͭͭVPCΛ֬ೝ
ʊਓਓਓਓਓਓਓਓਓਓʊ ʼɹར༻ՄೳͳIP: 1ɹʻ ʉY^Y^Y^Y^Y^Y^Y^Yʉ
VPCͷIP͕ރׇ • /25Ͱ128͋ΔͣͷIP͕ރׇ • ݪҼେྔʹੜ͞Ε͍ͯͨENI (!) • TerraformͰىಈͨ͠Spot Fleetಛఆͷ݅ ԼͰ
DeleteOnTermination ͕falseͷΠϯελ ϯεΛىಈ͢Δ
PR͛·ͨ͠ • ͰϚʔδ͞ΕΔ༧ײແ͠
Ձ֨ͷҟৗͳཚߴԼ • Ұ࣌ظɺͬͯΔϓʔϧͷஈ͕ݢฒΈߴಅ ͯ͠શવ҆ఆͯ͠ΠϯελϯεΛ֬อͰ͖ͳ ͍࣌ظ͕͋ͬͨ • ΦϯσϚϯυฒྻىಈͯ྇͗͠·ͨ͠ • ถେ౷ྖબͷλΠϛϯά͕͔ؔͯͨ͠…
diversifiedͳͷʹภΔ • ͳ͔ͥdiversifiedͰىಈ͢ΔΠϯελϯε͕ಉ ͡ϓʔϧ͔Βىಈ͍ͯ͠Δ • AWSͷํʹฉ͍ͨͱ͜Ζɺࢄ͢ΔͳΒ3 Ҏ্ඞཁΒ͍͠ • ఆظతʹΠϯελϯεΛআͰ͖Εɺ࠷҆ ͷϓʔϧ͔Βىಈ͢ΔͷͰࢄ͢Δ͔…ʁ
Chaos Monkeyͷػӡ
ͪͳΈʹ • Chaos Monkey in Lambda͋ΔΑ
·ͱΊ
·ͱΊ • ͓҆͘ͳΔͷͪΖΜɺෆྀͷোΛఆ ͨ͠ઃܭΛ༨ّͳ͘͞ΕΔͷͰɺΞʔΩςΫ νϟ͕ڧਟʹͳΔ • ੲεϙοτΠϯελϯεҰ࣌తͳόον ॲཧ͖͕ͩͬͨɺSpot Fleet͕ঢ়گΛม͑ͨ •
࠷ߴͳͷͰΈΜͳ͓͏ʂʂ