Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ゲンバのサービス運用
Search
komuro-sapporo
May 27, 2017
Technology
2
1.3k
ゲンバのサービス運用
【 大阪オフィス開設1周年勉強会 】開発者のための楽しいAWSのサービス運用 in 大阪 2017/05/26 #cm_osaka
komuro-sapporo
May 27, 2017
Tweet
Share
More Decks by komuro-sapporo
See All by komuro-sapporo
How To 脆弱性対応
komurosappro
0
680
内容は話せないけどGamedayのススメ
komurosappro
0
520
大阪勉強会_第5回.pdf
komurosappro
0
4
運用事件簿
komurosappro
0
2.5k
Introduction of Jooby. DevIO2016
komurosappro
0
1.3k
Other Decks in Technology
See All in Technology
累計2500万着電を支える大規模 電話自動応答サービスのアーキテクチャ / Architecture of a Large-Scale Automated Phone Response Service Supporting 25 Million Cumulative Calls
ymachida
8
4.3k
2024/11/29_失敗談から学ぶ! エンジニア向けre:Invent攻略アンチパターン集
hiashisan
0
250
生成AIを活用したIT運用高度化への挑戦
iotcomjpadmin
0
290
LLMアプリケーションの評価と継続的改善
pharma_x_tech
2
180
メインテーマはKubernetes
nwiizo
2
320
ARRが3年で10倍になったプロダクト開発とAI活用の軌跡
akiroom
0
190
レガシーシステムへのDatadog APM導入奮闘記
mtakeya4062
0
130
データ共有による新しい価値の創造
iotcomjpadmin
0
300
プラットフォームエンジニアリングアーキテクチャ道場 on AWS & EKS Kubernetes / Platform Engineering Architecture Dojo
riita10069
7
16k
Kubernetesを知る
logica0419
17
4.4k
50以上のマイクロサービスを支えるアプリケーションプラットフォームの設計・構築の後悔と進化 #CNDW2024 / regrets and evolution of application platform
toshi0607
5
620
ファインディの4年にわたる技術的負債の返済 / Repaying 4 Years of Technical Debt at Findy
ma3tk
3
1k
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
33
1.5k
Raft: Consensus for Rubyists
vanstee
136
6.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Bash Introduction
62gerente
608
210k
Designing Experiences People Love
moore
138
23k
Navigating Team Friction
lara
183
15k
A Modern Web Designer's Workflow
chriscoyier
693
190k
[RailsConf 2023] Rails as a piece of cake
palkan
52
5k
Unsuck your backbone
ammeep
669
57k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
1
220
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Transcript
ήϯόͷαʔϏεӡ༻ ָ͍͠AWSͷαʔϏεӡ༻
͡Ίʹ ࣗݾհ ▸ খࣨ ܒʢ͜ΉΖɹͻΒ͘ʣ@com4dc ▸ ϞόΠϧΞϓϦαʔϏε෦όοΫΤϯυνʔϜ ▸ Java, Scala,
Pythonͱ͔ ▸ ࡛ۄੜ·Εࡳຈࡏॅ ▸ ࡳຈΦϑΟεॴଐ ▸ ํ։ຽ
͡Ίʹ ࡳຈ͔Βདྷ·ͨ͠ ▸ Ҡಈڑ1600km͘Β͍ ▸ 10℃͘Β͍ؾԹ͕ࠩ༗Γ·͢(ॵ͍)
None
ؓٳ
͡Ίʹ
ӡ༻ ͖Ͱ͔͢ʁ
ਖ਼ॳ͋·Γڵ ຯ͕͋Γ·ͤΜͰ͠ ͨ
ͦΜͳ։ൃऀ͕ӡ༻ Λܦݧͯͬͨ͠ ήϯόͷ
ӡ༻ʹର͢Δ BEFORE AFTER
ӡ༻ʹ͍ͭͯ ॳͷӡ༻Πϝʔδ ▸ ໘ന͘ͳ͍ ▸ ։ൃ͕ग़དྷͳ͍ ▸ ো͕༧ଌͰ͖ͳ͍ʢવ͚ͩͲʣ ▸ τϥϒϧγϡʔςΟϯάͰϐϦϐϦ
▸ ݮํࣜ ▸ ౖΒΕΔ͜ͱ͋ͬͯ๙ΊΒΕΔ ͜ͱ͕গͳ͍
ӡ༻ʹ͍ͭͯ ࠓͷӡ༻Πϝʔδ ▸ ໘ന͍ʢୀ۶͠ͳ͍ʣ ▸ ৭ʑͱ։ൃͯ͠Δ ▸ ো༧ଌͰ͖ͳ͍͚ͲɺݪҼಛఆɺ ରԠ͢Δͷָ͍͠ɻ಄͏͠ ▸
͖ͪΜͱઆ໌͢Εೲಘͯ͘͠ΕΔ ͓٬༷ͳͷͰͱͯ৴པͰ͖Δ ▸ ͖ͪΜͱධՁͯ͠Β͑Δ
ӡ༻ʹ͍ͭͯ AWSΛ͔ͳΓϋʔυʹ͏ ▸ ୭ฉ͍ͨ͜ͱݟͨ͜ͱແ͍ࣄαʔϏεͷ݀Λ౿ Ή͜ͱ͕͋ΔʢάάͬͯԿ͔Βͣʣ ▸ AWSΤϏσϯεͱͱʹΨϯΨϯϑΟʔυόοΫ ▸ Βͳ͍ະͷੈքΛܦݧ͍ͯ͠Δ ▸
→ɹָ͍͠
ӡ༻ʹ͍ͭͯ ։ൃͱӡ༻ͷڱؒ ▸ ։ൃͷࣝͰෆे ▸ αʔϏε͕ͲͷΑ͏ʹӡ༻͞ΕͯՁ ΛੜΉ͔ͷ૾ྗ͕Βͳ͍ ▸ ࣮ࡍʹࣗͰ͏Θ͚Ͱͳ͍ͨΊɺ ϩάͷઃܭ͕͍
▸ ։ൃͱӡ༻ΛߦͬͨΓདྷͨΓ͍ͯ͠Δ ͱɺํͷཱ͔Β࣮ରԠΛධՁ ͢Δ͜ͱ͕ग़དྷΔ ▸ ಄ͷContext SwitchසൟʹΓସ͑Δ
ӡ༻ʹ͍ͭͯ ӡ༻Λܦݧͯ͠ॏཁੑΛೝࣝͨ͜͠ͱ ▸ ϩά ▸ োݕ ▸ ઃܭ ▸ ӡ༻Λࢧ͑ΔͨΊʹ։ൃऀ͕ग़དྷΔ͜ͱ
▸ ίϛϡχέʔγϣϯ
AWSΛར༻ͨ͠ γεςϜӡ༻
AWSΛར༻ͨ͠γεςϜӡ༻ ୲γεςϜ ▸ ECαΠτͷೝূج൫ٴͼϢʔβʔཧ ▸ Ϣʔβʔ300ສʙ ▸ Ωϟϯϖʔϯ࣌ʹ࠷େؒʙ5ສΞΫηεఔ ▸ ಛతͳAWSαʔϏε
▸ EB docker, DynamoDB Streams, Lambda ▸ Java8+SpringBoot, Scala+Play
AWSΛར༻ͨ͠γεςϜӡ༻ ϓϩδΣΫτΛߏ͢ΔେྔͷαʔϏε
None
AWSΛར༻ͨ͠γεςϜӡ༻ ͨ͘͞ΜͷϝϦοτ ▸ ϚωʔδυαʔϏεΛར༻͢Δ͜ͱͰϝϯςφϯεϑϦʔ ▸ ͍͍ͨαʔϏεΛʢେମʣ͙͢ར༻Ͱ͖Δ ▸ ͲͷαʔϏεʢ֓Ͷʣ؆୯ʹεέʔϧͰ͖Δ ▸ ෛՙͷنʹԠͯ͡εέʔϧΞτɺεέʔϧΠϯͰ͖Δͨ
Ίɺίετ࠷దԽ ▸ ো࣌ͷ෮چɾରࡦૉૣ͘Ͱ͖Δ
AWSΛར༻ͨ͠γεςϜӡ༻ AWSಛ༗ͷӡ༻ઃܭ࣌ʹߟྀ͖͢ࣄ߲ ▸ AWSϚωʔδυαʔϏεͷϩάݶఆత ▸ োͷݕϝτϦΫεͱΞϥʔϜͷઃఆ࣍ୈ ▸ ϩάશͯߴ৴པੑͷαʔϏεूͤ͞Δ ▸ ϚωʔδυαʔϏεͱͷ伱ؒΛͲͷΑ͏ʹࢹ͢Δ͔
▸ 100%Քಇͷ1Λࢦ͢ͷͰͳ͘ɺ90%ΛෳଋͶͯ τʔλϧͰ100%Λࢦ͢ͱ͍͏ߟ͑ํ
AWSΛར༻ͨ͠γεςϜӡ༻ ΦϯϓϨӡ༻ͱجຊతʹಉ͡ ▸ োඞͣൃੜ͢Δ ▸ ԿʹͦͷোΛίϯτϩʔϧԼʹ͓͚Δ͔͕ͱͯେࣄ ▸ ϩάʂͳʹͱ͋Εϩάࢮकʂʂ
ϩάͷॏཁੑ
ϩάͷॏཁੑ ϩάݪҼڀ໌ʹඞਢ ▸ ϩά͕ͳ͍ͱݪҼڀ໌͕શ͘ग़དྷͳ͍ ▸ ϩά͕ଘࡏ͠ͳ͍ݱଘࡏ͠ͳ͍ͷͱಉ͡ ▸ ͨͩ͠ɺϊΠζͩΒ͚ͷϩάҙຯͳ͍ɻϩάͱͯ͠ҙຯ ͷ͋ΔใΛग़ྗ͢Δɻ ▸
ϩάઈରʹࢮकʂফͨ͠ΒऴΘΓͱࢥ͏͠
ϩάͷॏཁੑ ϩάશͯߴ৴པੑͷαʔϏεूͤ͞Δ ▸ EC2Πϯελϯε͍ͭফࣦ͢Δ͔͔Βͳ͍(ઃఆʹΑΔ ͚Ͳ) ▸ ඞཁͳϩάߴ৴པੑͷετϨʔδαʔϏεूͤ͞Δ ▸ EC2Λ͡Ίɺ༰қʹScale Out,
Scale In͢Δͷ͕ಛ ▸ αʔϏεͷ෦ʹσʔλϩάΛ͓ͯ͘͜͠ͱɺϩετ ͷةݥੑ͕͋Δ͜ͱΛೝࣝ͢Δ
ϩάͷॏཁੑ EC2ʹϩά͕ͬͯ͠·͏ͱϩετ͢Δ ASG EC2 EC2 EC2 ϩά ϩά ϩά ASG
EC2 EC2 EC2 ϩά ϩά ϩά
ϩάͷॏཁੑ ϩάͷूͷߏ EC2 ELASTIC BEANSTALK FLUENTD + CWLOGS CWLOGS AGENT
CLOUDWATCH LOGS EC2 FLUENTD + ES
ϩάͷॏཁੑ ར༻͍ͯ͠ΔϩάετϨʔδ ▸ Cloudwatch Logs: ΞϓϦέʔγϣϯϩάΛूɻো࣌ ਅͬઌʹ͜͜Λ֬ೝ͢Δɻ ▸ Amazon ES:
ϩάΠϯཤྺ, ϝʔϧςϯϓϨʔτͳͲͷૢ࡞ ϩάͳͲΛूɻ ▸ Amazon S3: CloudTrailͷϩάͳͲ͕֨ೲɻϑΝΠϧͰͷอ ଘʹͳΔͨΊݕࡧੑ͍ɻ࠷ऴखஈʂʢ࠷ۙAthena͕ग़ ͨͨΊΫΤϦͰͷݕࡧੑ্͕ͬͨʣ
ϩάͷॏཁੑ ϩάͰେࣄͳ͜ͱ ▸ ଘࡏͤ͞Δ͜ͱɻదͳϥΠϑαΠΫϧ͕ऴΘͬͨϞϊҎ֎ ઈରࢮकɻ ▸ ݕࡧཁ݅ʹԠͯ͡ετϨʔδઌΛબఆ͢Δ͜ͱɻසൟʹݕ ࡧ͕ඞཁͳϩάΛݕࡧੑͷ͍ετϨʔδʹஔ͢Δͱޙʑ ۤ࿑͢Δɻ ▸
τϨʔαϏϦςΟɻ͜Εӡ༻ଆ͕ؾΛ͚ͭΔ͜ͱͱ͍͏Α Γ։ൃଆ͕ߟྀ͖͢͜ͱɻޙड़
োΛ ݕ͢Δ
AWSΛར༻ͨ͠γεςϜӡ༻ োͷݕϝτϦΫε࣍ୈ ▸ AWS༷ʑͳϝτϦΫεΛఏڙͯ͘͠Ε͍ͯΔ ▸ ͲͷϝτϦΫεΛࢹ͢Δ͔Ϣʔβʔ࣍ୈ ▸ ϝϞϦ༰ྔͳͲҰ෦ࣗͰΧελϜ͠ͳ͍ͱࢹͰ͖ͳ͍ ▸ ֤αʔϏεʹΑͬͯࢹ߲มΘΔʢมΘΒͳ͍߲͋Δ͚Ͳʣ
AWSΛར༻ͨ͠γεςϜӡ༻ ݕઃఆෆඋʹΑΔࣄނ ▸ EC2ͷΞϓϦέʔγϣϯϩάΛAgentܦ༝ͰCloudwatch LogsϦΞϧλΠϜసૹ͍ͯ͠Δঢ়ଶ
AWSΛར༻ͨ͠γεςϜӡ༻ োͰసૹ͕ఀࢭ ▸ సૹ͕ྃ͠ͳ͍ͨΊɺϩʔΧϧϩά͕ཷ·Γ࢝ΊΔ ʢ.tmpϑΝΠϧʣ
AWSΛར༻ͨ͠γεςϜӡ༻ ͍ͣΕEC2σΟεΫϑϧʹ ▸ σΟεΫϑϧͰαʔϏε͕ఀࢭʂʂˠ ൃ֮
AWSΛར༻ͨ͠γεςϜӡ༻ దͳࢹϝτϦΫεΛઃఆ͢Δ ▸ EC2ͷσΟεΫ༻Λܭଌ͢ΔϝτϦΫε͕ඞཁ ▸ ͞ΒʹྔʹԠͯ͡ΞϥʔϜΛઃఆ͢Δ ▸ σΟεΫϑϧʹΑΔαʔϏεఀࢭͷඃ͜ΕͰࣄલʹ ͢Δ͜ͱ͕Ͱ͖Δ $
df -H Filesystem Size Used Avail Use% Mounted on /dev/xvda1 11G 11G 0 100% / devtmpfs 4.0G 119k 4.0G 1% /dev tmpfs 4.0G 0 4.0G 0% /dev/shm
AWSΛར༻ͨ͠γεςϜӡ༻ ೋಉ͡োى͜͞ͳ͍ ▸ ಉ͡োى͜͞ͳ͍Α͏ʹɺݪҼڀ໌ͱࢹͷڧԽ ͢ΔɻKPTେࣄɻ ▸ ࠜຊతղܾʹࢸΒͳͯ͘ؾͮ͘͜ͱେࣄ ▸ ଞʹߟ͑ΒΕΔͷCloudwatch Logsͷసૹ͕ఀࢭͯ͠
͍Δ͜ͱΛݕ͢Δ͜ͱͰ͖ͳ͔ͬͨͷ͔ʁͱ͔ ▸ ͨͩ͜Ε໌֬ͳج४ͱͳΔϝτϦΫε͕Θ͔Βͳ͍ʢԿ Λܭଌ͢Ε͍͍ͷʁʣ
ӡ༻ͷͨΊͷ ։ൃ৺ಘ
։ൃऀͲ͏͢Δ͔ ӡ༻Λݟਾ͑ͨઃܭΛࢦ͢ ▸ ϩάઃܭʢτϨʔαϏϦςΟɺϩάͷཻɺใʣ ▸ ϩάϨϕϧਵ࣌ݟ͢ ▸ ϚωʔδυαʔϏεͷར͚ͩʹ͢ΔͷͰͳ͘ɺΤ ϥʔɺϝϯςφϯε࣌ͷಈ࡞ߟྀ͢Δ ▸
ൺֱతݹ͔͘Β͋Δ҆ఆͯ͠ΔαʔϏεΛબͿ͜ͱେ ▸ ϚωʔδυαʔϏεͷ伱ؒΛߟྀͨ͠ઃܭ
։ൃऀͲ͏͢Δ͔ ։ൃऀ͕ߟྀ͖͢ϩάઃܭࣄ߲ ▸ ϩάͷΈͰૢ࡞ΛτϨʔεͰ͖Δ͔ʢτϨʔαϏϦςΟʣ ▸ ग़ྗ༰ɻϚεΫ͖߲͢ͷཧ ▸ ϩάϨϕϧͷઃܭ Ұ൪ॏཁͳ͕ͣͩɺ։ൃ࣌༏ઌ ͕Ίͳͷ͕࣮
։ൃऀͲ͏͢Δ͔ ΞϓϦέʔγϣϯϩάΛू͢Δ ▸ ࢄ֤ͨ͠αʔόʔ͔ΒϩάΛूͨ࣌͠ʹશ͕ͯόϥόϥʹه͞ΕΔ ▸ ಛఆͷϦΫΤετΛऔΓग़͢ͷࢸͷۀ
։ൃऀͲ͏͢Δ͔ ղܾɿϦΫΤετ͝ͱʹҰҙͳIDΛੜ͢Δ ▸ 1ϦΫΤετʹରͯ͠શͯҰҙͳRequestIDΛ༩͢Δ ▸ ։ൃͨ͠APIαʔόʔɺ΄΅શͯUUIDΛར༻ͯ͠Ұҙͳ RequestIDΛੜ ▸ ࣌ʴRequestIDͰ࣮֬ʹಛఆ͕Ͱ͖Δ ▸
Ұ࿈ͷϦΫΤετͷΠϕϯτΛτϨʔεͰ͖ɺCloudwatch Logs͔Β༰қʹݕࡧ͕Մೳʹɻ
։ൃऀͲ͏͢Δ͔ ϩάৗʹվળ͢Δ ▸ ։ൃ࣌ʹߟྀ͕࿙Ε͍ͯͨՕॴΨϯΨϯվળ͢Δ ▸ ग़ྗ͍͚ͯ͠ͳ͍߲ͷϚεΫ ▸ ϩάϨϕϧࡉ͔͘ௐ͢Δ ▸ ΑΓਫ਼ີͳΞϥʔϜͱͳΓɺຊʹਂࠁͳোͷΈใࠂ
ͤ͞Δ
ϚωʔδυαʔϏ εͷ伱ؒΛߟ͑Δ
AWSΛར༻ͨ͠γεςϜӡ༻ ϚωʔδυαʔϏεͱͷ伱ؒΛͲͷΑ͏ʹࢹ͢Δ͔ ▸ ଟछଟ༷ͳϚωʔδυαʔϏεΛΈ߹ΘͤΔͱࢹ͕ߦ ͖ಧ͔ͳ͍伱͕ؒੜ·ΕΔ ▸ ͜ͷ伱ؒυΩϡϝϯτΛಡΜͰॻ͍ͯ͋ΔΘ͚Ͱͳ͍ ▸ ϚωʔδυαʔϏεͷಛੑΛཧղ͠ɺܦݧΛੵΉଞͳ͍ ▸
ԿΛࣦͬͯഊ͍ͯ͠Δ͔ͱ͍͏ఆྔతͳஅ͕Ͱ͖Δج४ Λ୳͢ʢྫɿ5Ҏ্ॻ͖ࠐΈ͕ͳ͍͜ͱ͋Γ͑ͳ͍ɺ σʔλ͕24hҎ্ಉظ͞Εͳ͍͜ͱ͋Γ͑ͳ͍ɹʣ
AWSΛར༻ͨ͠γεςϜӡ༻ DYNAMODB STREAMSΛͬͨಉظॲཧ HTTP STATUSͰ ݕ εςʔλεΛ ࢹ ىಈ͔ͨ͠Ͳ͏ ͔ݕ
εςʔλεΛ ࢹ ▸ ֤αʔϏεຖʹΤϥʔোͷݕՄೳ ▸ ͜ͷதͰࢹͷ伱ؒͱͳͬͯ͠·͏ͷʁ http://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/CHAP_Monitoring.html DLQ
AWSΛར༻ͨ͠γεςϜӡ༻ DYNAMODB STREAMSΛͬͨಉظॲཧ ͜͜ ▸ DynamoDB Streamsͷγϟʔυɻ͜Εʢࠓͷͱ͜Ζʣ୭ ࢹͰ͖ͯͳ͍
AWSΛར༻ͨ͠γεςϜӡ༻ ઃఆͰ͖ΔϝτϦΫε͕ͳ͍ɾɾʁ σʔλ͕ߋ৽ ▸ ͜ͷγϟʔυΛࢹ͢ΔϝτϦΫε͕ݟ͔ͭΒͳ͍ ▸ LambdaͰͷࢹՄೳʁ => ߋ৽͞Εͯͳ͍ͷ͔ͦΕͱ োͰΩοΫ͞Εͳ͍ͷ͔͔Βͳ͍ɻ
ʁʁʁ ߋ৽͞Εͯͳ͍ʁ ͦΕͱোʁ
AWSΛར༻ͨ͠γεςϜӡ༻ ࣮֬ʹಉظΛͱΔվળࡦ σʔλ͕ߋ৽ WORKER QUEUEΛࢹɻಉظྃ ޙϝοηʔδআ ಉظ֬ೝ ▸ SQSʴWorkerͰಉظΛ֬ೝ͢Δ
AWSΛར༻ͨ͠γεςϜӡ༻ςΩετ ઃܭΛݕূ͢Δ ▸ ඇಉظͰ࣮ߦ͞ΕΔΠϕϯτͷͨΊɺීஈͨ·ͨ·0ඵͰಉظ ͞Ε͍ͯΔ͚ͩʢ࠷େ24࣌ؒͷΕʣ ▸ σʔλͷੑ֨ʹΑͬͯ࠷ऴతʹ⁋᧒͕߹ͬͯΕྑ͍ͷ͋ Δ ▸ γϟʔυίϯςφͷϥΠϑαΠΫϧʢଟʣͰ࡞Γ͞ΕΔͷ
Ͱɺͦͷ͏ͪഁغ͞Ε࣍ͷߋ৽࣌ʹ࣮ߦ͞ΕΔՄೳੑ͕ߴ͍ ▸ ઈରʹಉظ͕ͣΕ͍͚ͯͳ͍σʔλͩͱվળࡦͷΑ͏ͳνΣο Ϋػೳ͕ඞཁʹͳΔ
·ͱΊ
·ͱΊ ӡ༻ΛΔ͜ͱֶͼ͕͋Δ ▸ αʔϏεӡ༻͢Δ͜ͱͰՁ͕ग़Δ͜ͱΛ࣮ײͰ͖Δ ▸ γεςϜΛམͱͣ͞ʹฏԺΛҡ࣋͢Δ͜ͱ͕Կʹ͘͠େ ͳ͜ͱ͕Α͔͘Γɺಈ͚͍͍Έ͍ͨͳ৺ࠜΛୟ͖ ͤ͞ΒΕΔ ▸ ࣗͷ୲֎ͷ༷ʑͳٕज़ʹ৮ΕΔ͜ͱ͕Ͱ͖Δ
▸ ΫϥυͷརͱऑΛΛͬͯΔ͜ͱ͕ग़དྷΔ ▸ ϩάࢮकʂʂʂ
WE ARE HIRING!
MEET UP COMES BACK 2017/07/த େࡕΦϑΟε COMING SOON!