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
某サービスのリニューアルでECSを導入したよもやま話
Search
Tomohiro MITSUMUNE
May 22, 2018
Technology
1
2.6k
某サービスのリニューアルでECSを導入したよもやま話
Healthtech Meetup vol.1で発表したスライド
Tomohiro MITSUMUNE
May 22, 2018
Tweet
Share
More Decks by Tomohiro MITSUMUNE
See All by Tomohiro MITSUMUNE
Swift2 New Features
tmitz
0
130
5分でわかるAdequateRecord
tmitz
1
460
Other Decks in Technology
See All in Technology
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
150
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
130
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Engineer Career Talk
lycorp_recruit_jp
0
190
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
190
Lambdaと地方とコミュニティ
miu_crescent
2
370
組織成長を加速させるオンボーディングの取り組み
sudoakiy
2
200
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
AI前提のサービス運用ってなんだろう?
ryuichi1208
8
1.4k
複雑なState管理からの脱却
sansantech
PRO
1
150
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
180
21k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Fireside Chat
paigeccino
34
3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
What's new in Ruby 2.0
geeforr
343
31k
We Have a Design System, Now What?
morganepeng
50
7.2k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Bash Introduction
62gerente
608
210k
Code Reviewing Like a Champion
maltzj
520
39k
Transcript
αʔϏεͷϦχϡʔΞϧͰ ECSΛಋೖͨ͠Α· Healthtech Meetup vol.1 2018/05/22 גࣜձࣾΤεɾΤϜɾΤεɹޫफ๎
ࣗݾհ • ໊લ: ޫफ ๎ (@t_mitz ) • ձࣾ: גࣜձࣾΤεɾΤϜɾΤε
ϓϩμΫτ։ ൃ෦ ٕज़ਪਐάϧʔϓ • (ϔϧεέΞΆ͍)झຯɿϚϥιϯ ! • ߦಈม༰εςʔδϞσϧҡ࣋ظ
None
גࣜձࣾΤεɾΤϜɾΤε • IT x ҩྍɾհޢɾϔϧε έΞྖҬͷύΠΦχΞ اۀ • ߴྸࣾձΛऔΓר͘ਓʑ ͕ΠΩΠΩͱੜ׆Ͱ͖
ΔΠϯϑϥͷߏங
None
͡ΊΔલʹ
࣮·ͩಋೖऴΘͬͯ·ͤΜ" • հޢαʔϏεͷΞϓϦέʔγϣϯͷվमͱฒ ߦͯ͠ECSͷߏஙΛ͢͢Ί͍ͯΔ • ຊ൪ӡ༻։࢝·Ͱʹ༻ҙ͓͚ͯ͠Α͍Օॴʹ ͍ͭͯ·ͩະணखʢAWSͷίετ੍ͳͲʣ • ࢼߦࡨޡ͍ͯͨ͠ͱ͜ΖΛੜԹ͔͍Ͱ͝ཡ͍ ͚ͨͩΔͱ͍Ͱ͢
ࠓͷΞδΣϯμ • ECSΛ࠾༻ͨ͠ཧ༝ • ߏʹ͍ͭͯ • Α·
ECSΛ࠾༻ͨ͠ཧ༝
࠾༻ཧ༝ • ϩʔΧϧڥʹDockerಋೖࡁΈͩͬͨͷͰຊ൪ ڥͰಉ͡ͷΛಈ͔ͯ͠ݕূ͍ͨ͠ • ࣗલͰίϯςφͷΦʔέετϨʔγϣϯΛඋ͢ Δͷίετ͕ߴ͍ͷͰطଘͷιϦϡʔγϣϯΛ ͍͔ͨͬͨ • ΦϯϓϨ͔ΒύϒϦοΫΫϥυҠߦͷλΠϛ
ϯάͰΞʔΩςΫνϟΛݟͤΔλΠϛϯά
Google Kubernetes Engine ? • GKEͩͱIAM͕AWS΄Ͳࡉ੍͔͘ޚͰ͖ͳ ͍ʢ࣌ʣͷͰཁ݅ΛຬͨͤΒΕͳ͔ͬͨ • ࣾͷผαʔϏε͕ઌͩͬͯAWSҠߦ͠ ͨͱ͍͏എܠ͕͋ΓɺࣾͷφϨοδ͕ஷ
·Γ͍͢Α͏ʹAWSΛબఆ
Kubernetes on AWS ? • kube-aws ͔ kops Λར༻ͯࣗ͠લͰΫϥελ Λߏங͢Δඞཁ͕͋Γॳظֶशίετߴ͍
• ࣗ1ਓͰͬͯͨͷͰͱΓ͋͑ͣαΫοͱಈ ͔ͤΔڥΛ४උ͢Δඞཁ͕͋ͬͨ • ͳΔ͘ϑϧϚωʔδυʹد͔ͤͨͬͨ
ߏ
None
CircleCI • ࠓςετͷ࣮ߦͷΈΛ͍ͬͯ·͢ • গ͠લ·ͰίίͰdocker imageΛbuild & pushͯ͠·ͨ͠ • CIʹ͔͔࣌ؒΓ͗͢ͰPRͷϚʔδʹӨڹ͋Δ
CodePipeline • CodePipelineΛར༻ͯ͠GithubͷϒϥϯνΛ ࢹͯ͠ߋ৽͕͋ΔͱECSσϓϩΠ • CodebuildͰdocker image build ͯ͠ECR push
• CodePipelineͷdeployͰECSσϓϩΠ
Deploy to ECS • Ҏલecs-deployΛ͍͕ͬͯͨɺ CodePipelineΛ͏ํ͕ߏ͕γϯϓϧʹ ͳͬͯϝϯςφϯε͍͢͠ͷͰ࠾༻ • hakoݕ౼ͯ͠Έ্͕ͨهಉ༷ʹ CodePipelineͷํ͕γϯϓϧͩͬͨ
Logging • ී௨ʹ awslogs driver Ͱ CloudWatch Logsʹ ऩूͯ͠·͢ •
ϩάΛݟΔɺͱ͍͏ࣄʹؔͯ͠ࠔ͍ͬͯ· ͤΜʢCloudWatch LogsͰ୳͠ʹ͍͘ͱ͍͏ ͷஔ͍ͱ͍ͯ
ECS • 1αʔϏε1λεΫఆٛ • 1λεΫʹ3ͭͷίϯςφΛఆٛ • h2o • rails •
shoryuken
None
Α·
ఆظతͳόονॲཧ • CloudWatch EventsΛར༻ • ࣌ؒʹΑΔఆظ࣮ߦͰ͖Δ͠ɺAWSίϯ ϙʔωϯτͷΠϕϯτhookͰ͖ͯΜΓ • ECSͷλεΫఆٛΛ༻ҙͯ͠call͢ΕOK
ߏཧ • ߏཧͯ͢CloudFormation • ChangeSets͕ΜΓ • IAMͰͷݖݶཧ͕ڧྗ • awscliʹৄ͘͠ͳΕ·͢
Terraform ʹ͠ͳ͔ͬͨཧ༝ • ϚϧνΫϥυʹ͢Δඞཁੑ͕ࠓͷͱ͜Ζͳ͔ͬͨ • HCLಡΈ͍͕͢ಠࣗDSLͬͯॴ͕ΠϚΠν • ෳਓͰߏཧ͢Δͱ͖tfstateཧΛؾʹͨ͘͠ ͳ͔ͬͨ •
࣮ߦޙʹίέͨͱ͖ͷϦΧόϦ͕cfnΑΓίετߴ
AWS::Cloudformation::Stack • AWSίϯϙʔωϯτ͝ͱʹstackϑΝΠϧΛఆ ٛͯ͠ɺͦΕΒΛϦιʔεͱͯ͠ωετͯ͠ ཧͰ͖Δͭ • খ͍͞୯ҐͰςϯϓϨʔτΛ࡞͓͚ͬͯ Έ߹ΘͤͯߏΛม͑ΒΕΔͷͰΜΓ
ൿಗใ • SSM::Parameter StoreΛར༻ • ΞϓϦʹ͢ڥม͜͜Ͱཧ • Ҏલyaml_vaultΛͬͯΞϓϦέʔγϣϯ ʹ͍͚࣋ͨͤͯͨͲɺͪ͜Βͷํ͕γϯϓϧ •
AWS Secrets Manager͜Ε͔Βݕ౼
AutoScaling • EC2 AutoScaling • CPUReservation • ECS Service AutoScaling
• ·ͩຊ൪ӡ༻Λ։͍࢝ͯ͠ͳ͍ͷͰະઃఆ • EC2ͱECSͷAutoScaling͕ผϨΠϠͰಈ͘ͷͰΠϯε λϯε૿ݮ࣌ʹλεΫͷஔΛߟྀ͠ͳ͍ͱ͍͚ͳ͍
CPUͱReservedMemory • ECSͰΊΜͲ͍͘͞ͷ͕Clusterʹඥ͚ͨEC2ͷϦιʔ εΛTaskDefinitionͰΛܭࢉ͢Δඞཁ͕͋Δ͜ͱ • σϓϩΠ࣌ɺMaxMaximumPercent & MinimumHealthyPercent ߟྀͨ͠ʹ͓͔ͯ͠ͳ ͍ͱࠔΔ͕ීஈϦιʔε͕एׯ༨͍ͬͯΔײʹͳΔ…
• ༻్ʹΑͬͯFargate͕౦ژʹ͘Δͱղܾ
·ͱΊ
·ͱΊ • CloudformationͦΜͳʹѱ͘ͳ͍ͷͰAWSͷ ΈͰด͡ΔߏͳΒ͏ͷΞϦͰ͢ • ECSEC2ϨΠϠͱίϯςφϨΠϠͷཧ͕গ ͠ʹͳΔͷͰ͕ඞཁ • Code*γϦʔζੲΑΓ͜ͳΕ͍ͯΔͷͰ͏ ͱΜΓͳγʔϯ͕ଟΊͰ͢
ΤϯδχΞืूͯ͠·͢ʂ ৄ͘͠Wantedlyͷืूͷ֓ཁΛ