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
ヤプリにおけるAWSコスト最適化の取り組み
Search
kmitsuhashi
October 30, 2023
Technology
0
510
ヤプリにおけるAWSコスト最適化の取り組み
kmitsuhashi
October 30, 2023
Tweet
Share
More Decks by kmitsuhashi
See All by kmitsuhashi
累計ダウンロード数1億8000万を超えるアプリケーションプラットフォームのレガシーシステム脱却とモダン化への道
kmitsuhashi
0
280
Other Decks in Technology
See All in Technology
Amazon_CloudWatch_ログ異常検出_導入ガイド
tsujiba
1
250
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
170
分布で見る効果検証入門 / ai-distributional-effect
cyberagentdevelopers
PRO
4
680
物価高なラスベガスでの過ごし方
zakky
0
290
AWSコンテナ本出版から3年経った今、もし改めて執筆し直すなら / If I revise our container book
iselegant
13
3.8k
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
830
生成AIの強みと弱みを理解して、生成AIがもたらすパワーをプロダクトの価値へ繋げるために実践したこと / advance-ai-generating
cyberagentdevelopers
PRO
1
170
クライアントサイドでよく使われる Debounce処理 をサーバサイドで3回実装した話
yoshiori
1
140
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
210
君は隠しイベントを見つけれるか?
mujyun
0
230
Databricksで構築する初めての複合AIシステム - ML15min
taka_aki
2
1.4k
Aurora_BlueGreenDeploymentsやってみた
tsukasa_ishimaru
1
120
Featured
See All Featured
KATA
mclloyd
29
13k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Optimizing for Happiness
mojombo
376
69k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Testing 201, or: Great Expectations
jmmastey
38
7k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
280
Six Lessons from altMBA
skipperchong
26
3.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
Transcript
ϠϓϦʹ͓͚Δ AWSίετ࠷దԽͷ औΓΈ
Speaker ϓϩμΫτ։ൃຊ෦ ج൫෦ SREάϧʔϓ ࡾڮ ᇈଠ େखSIerͰΠϯϑϥΤϯδχΞ/ΫϥυΞʔΩςΫ τͱͯ͠ͷܦݧΛੵΈɺ20224݄ΑΓϠϓϦͷ SREϝϯόʔͱͯ͠δϣΠϯɻݱࡏSREϓϥΫς ΟεͷಋೖΛத৺ͱͨ͠ۀʹྭΜͰ͍ΔɻAWSͱ
New Relicͱ່(ࠓ࢈·Εͨ)ͱϛχνϡΞμοΫε (·ͩࣂͬͯͳ͍)͕͖ɻҭٳ෮ؼϗϠϗϠ
01 02 03 04 05 AWSίετ࠷దԽͷऔΓΈഎܠ ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ ۩ମతͳίετ࠷దԽࢪࡦ ͦͷଞͷऔΓΈ ·ͱΊͱࠓޙͷ՝
01 AWSίετ࠷దԽͷ औΓΈഎܠ
͜Ε·Ͱ։ൃεϐʔυαʔϏε࣭͕༏ઌͰੵۃతͳࢿ͕ߦΘΕ͖͕ͯͨɺԁ҆ͷ ӨڹʹΑΓίετ͕ॏཁࢹ͞ΕΔΑ͏ʹͳͬͨ ԁ҆ͷӨڹͰίετ͕ॏཁࢹ͞Ε࢝ΊΔ 01 AWSίετ࠷దԽͷऔΓΈഎܠ ্ঢ 20211݄ 5݄ 9݄ 20221݄
5݄ 9݄ ച্ʹର͢ΔΠϯϑϥίετൺ
ΠϨΪϡϥʔͳίετ૿ʹରԠ͖ͯͨ͠ 01 AWSίετ࠷దԽͷऔΓΈഎܠ • ίετͷେ͖͍AWSΞΧϯτͷίετਪҠΛि࣍Ͱ֬ೝ͠ରԠΛߦ͖ͬͯͨ • AWSͰCost Anomaly DetectionͰҟৗͷࣗಈݕग़Ͱ͖ΔΑ͏ʹ͍ͯ͠Δ 0
50 100 150 200 9/1 9/2 9/3 9/4 9/5 9/6 9/7 RDS ECS CloudWatch ࢹͰͷίετ૿Ճ ͷ֬ೝ Cost Anomaly DetectionͰͷࣗಈݕग़
ैདྷͷΓํͷམͱ݀͠ 01 AWSίετ࠷దԽͷऔΓΈഎܠ • ͦͦͷίετ͕࠷దͰ͋ΔͱݶΒͳ͍ • ࠓճͷΑ͏ʹதظεύϯͰΠϯϑϥίετͷൺ্͕ঢ͍ͯ͠Δ߹ʹؾ͚ͮͳ͍ 0 50 100
150 200 9/1 9/2 9/3 9/4 9/5 9/6 9/7 RDS ECS CloudWatch ࣮࠷ॳ͔ΒաεϖοΫ ظ͔͠ݟ͍ͯͳ͍
৽ͨʹ໘ͭͭ͋͠Δ՝ 01 AWSίετ࠷దԽͷऔΓΈഎܠ ࣄۀ֦େʹ͍૿Ճ͢ΔAWSΞΧϯτʹ͕ಧ͔ͳ͘ͳΓͭͭ͋Δ prod stg dev prod stg dev
prod stg dev αʔϏεA༻ͷΞΧϯτ αʔϏεB༻ͷΞΧϯτ αʔϏεBͷҕୗઌ༻ͷ ΞΧϯτ SREνʔϜ શһ͕Ѳ Ұ෦ϝϯ όʔͷΈѲ ར༻ঢ়گෆ໌
01 AWSίετ࠷దԽͷऔΓΈഎܠ ࠓճͷऔΓΈʹΑΓ ͜Ε·Ͱͷ՝Λղܾ͢Δͱͱʹɺ ظؒͰ$10,000/݄ͷίετΛ ݮ͢Δ͜ͱʹޭͨ͠
02 ͲͷΑ͏ʹίετ࠷దԽʹ औΓΜ͔ͩ
Cloud Financial Management(CFM)ϑϨʔϜϫʔΫʹ͋ΔΑ͏ʹܧଓతͳίετ࠷దԽ Λ࣮ݱ͢ΔʹՄࢹԽ͕ඞཁͰ͋Δ ՄࢹԽ͔Β࢝ΊΔ 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ https://aws.amazon.com/jp/blogs/news/aws-cost-optimization-guidebook/
ίετΛ࠷దԽ͠Ϧιʔε ޮͱՁΛ࠷େԽ͢Δ
• ΞΧϯτԣஅͰίετਪҠΛ֬ೝ͍ͨ͠ • தظͰͷΛੳͰ͖ΔΑ͏ʹ͍ͨ͠ • Cost ExplorerͷΑ͏ʹৄࡉͳྉۚ༁͕ݟ͑ΔΑ͏ʹ͍ͨ͠ ͱݴͬͯ… • ࡞ΓࠐΈಋೖϝϯςφϯε͕େมͳͷͰආ͚͍ͨ
• खಈͰͷΦϖϨʔγϣϯۃྗආ͚͍ͨ • Cost ExplorerͰຖճؤுΔͷͭΒ͍ ࠷ߴͷμογϡϘʔυΛ࡞Γ͍ͨʂʂ 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ
AWS͔Βఏڙ͞Ε͍ͯΔίετ࠷దԽͷͨΊͷμογϡϘʔυ ςϯϓϨʔτ͕ఏڙ͞Ε͍ͯΔͨΊͰߏங͕Մೳ Cloud Intelligence Dashboards(CID)ʂʂ 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ https://www.wellarchitectedlabs.com/cost/200_labs/200_cloud_intelligence/
༷ʑͳαʔϏεͱ࿈ܞ ؍ͷҟͳΔμογϡ ϘʔυΛෳఏڙ
CIDͷಛ 1 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ ͲͷΞΧϯτͷͲͷϦιʔε ͷίετ͕ߴ͍͔Ұྎવ தظͰͷΞΧϯτશମͷ ίετਪҠ͕Θ͔Δ
https://d1s0yx3p3y3rah.cloudfront.net/anonymous-embed?dashboard=cudos
CIDͷಛ 2 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ S3 Storage Lens ͳͲͷίετ࠷దԽʹཱͭػೳ
ͱͷ࿈ܞ ίετ࠷దԽͷͨΊͷਪࣄ ߲Λදࣔ https://d1s0yx3p3y3rah.cloudfront.net/anonymous-embed?dashboard=cudos
CIDͷಛ 3 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ՄࢹԽ https://d1s0yx3p3y3rah.cloudfront.net/anonymous-embed?dashboard=cudos ࠓޙ༗ྉԽ͞ΕΔϦιʔεʹ ૉૣ͘ରԠ
• ਝʹίετΛ࠷దԽ͢ΔΫΠοΫΟϯ࠷దԽࢪࡦ͔Βݕ౼͢Δ • ఆ൪ͷࢪࡦ͚ͩͰͳ͘ɺ͔ͬ͠Γੳ্ͨ͠ͰࣗࣾͰͷΫΠοΫΟϯࢪࡦΛࡧ͢Δ ࠷దԽࢪࡦΛݕ౼͢Δ 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ࠷దԽ https://aws.amazon.com/jp/blogs/news/aws-cost-optimization-guidebook/
ఆ൪ͷΫΠοΫΟϯ ࠷దԽࢪࡦ
1. ίετͷେ͖͍ϦιʔεΛϦετΞοϓ͠ɺݪҼੳΛߦ͏ 2. ࠷దԽ༨͕͋ΔϦιʔεʹର͠ࢪࡦΛݕ౼͢Δ 3. ࢪࡦͷ࣮ࢪޮՌͱ࣮ࢪΛࢉग़͠༏ઌΛ͚ͭΔ қରޮՌͰࢪࡦʹ༏ઌΛ͚ͭΔ 02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ -
࠷దԽ https://aws.amazon.com/jp/blogs/news/aws-cost-optimization-framework/
02 ͲͷΑ͏ʹίετ࠷దԽʹऔΓΜ͔ͩ - ࠷దԽ ΞΧϯτ αʔϏε ݱঢ় ࢪࡦ ݮֹ
༏ઌॱҐ ํ Account A RDS m5.8xlarge εϖοΫ࠷దԽ $XXX/݄ 5 3 XXXͷͨΊอཹ Account A S3 ແظݶอଘ ϥΠϑαΠΫϧ ϙϦγʔઃఆ $XXX/݄ 2 2 ࣮ࢪ͢Δ Account B ElastiCache ෆཁϦιʔεՔ ಇ Ϧιʔεআ $XXX/݄ 1 1 ࣮ࢪ͢Δ Account A DynamoDB ΦϯσϚϯυΩ ϟύγςΟ ϦβʔϒυΩϟ ύγςΟߪೖ $XXX/݄ 3 4 XXXͷͨΊ࣮ࢪ ͠ͳ͍ ɾɾɾ
03 ۩ମతͳίετ࠷దԽࢪࡦ
S3 VPCΤϯυϙΠϯτΛར༻͢Δ 03 ۩ମతͳίετ࠷దԽࢪࡦ • ϓϥΠϕʔταϒωοτ͔ΒS3ΞΫηεͷࡍʹNAT GateawayΛ௨ΔΑ͏ʹͳ͍ͬͯͨ • S3ʹஔ͔ΕͨେྔͷassetσʔλʹΞΫηε͢ΔͨΊಛʹྉ͕ۚߴ͘ͳ͍ͬͯͨ ※
ap-northeast-1ϦʔδϣϯͰͷ20238݄25ݱࡏͷՁ֨ ແྉ Private subnet Public subnet VPC Endpoint (Gateway) AWS Fargate NAT Gateway Amazon Simple Storage Service (Amazon S3) asset $0.062/GB ※
• ΄ͱΜͲͷS3όέοτʹϥΠϑαΠΫϧϙϦγʔ͕ઃఆ͞Ε͍ͯͳ͔ͬͨ • S3 Storage LensͰංେԽ͍ͯ͠ΔόέοτΛಛఆ͠ରԠΛߦͬͨ S3ϥΠϑαΠΫϧϙϦγʔΛઃఆ͢Δ 03 ۩ମతͳίετ࠷దԽࢪࡦ S3
Standard S3 Glacier Instant Retrieval Archive Delete όέοτ͝ͱʹཁ݅ ʹ߹Θͤͯઃఆ Ҡߦ࣌ʹίετ͕ Ͷͳ͍͜ͱΛ֬ೝ
• σϑΥϧτͰContainer Insights༗ޮԽʹͳ͍ͬͯͨ • ಛʹ։ൃڥͰ50ۙ͘ͷECSΫϥελʔ͕ར༻͞Ε͓ͯΓɺେྔͷΧελϜϝτϦΫε ͕ૹ৴͞Ε͍ͯͨ ։ൃڥͷContainer InsightsແޮԽ͢Δ 03 ۩ମతͳίετ࠷దԽࢪࡦ
େྔͷΧελ ϜϝτϦΫε CloudWatch ECS Cluster ECS Cluster ECS Cluster ɾ ɾ ɾ
• ۀ࣌ؒʹ߹Θͤͯࣗಈىಈ/ఀࢭΛߦ͍͕ͬͯͨɺҰதར༻͞Εͳ͍͜ͱ͋ͬͨ • ։ൃऀ͕slack commandΛ͖ͬͯͳλΠϛϯάͰڥΛ্ཱͪ͛ΒΕΔΑ͏ʹͨ͠ ։ൃڥΛσϑΥϧτఀࢭʹ͢Δ 03 ۩ମతͳίετ࠷దԽࢪࡦ User AWS
Lambda ؒࣗಈఀࢭ EC2 & Fargate slack command API Call Πϯϑϥىಈ
• CloudWatch Logsͷϩάอ࣋ظؒઃఆ • ։ൃڥͷAuroraಉظσʔλͷݟ͠ • ෆཁϦιʔεͷఀࢭ/আ • AuroraόοΫΞοϓσʔλอ࣋ظؒݟ͠ •
։ൃڥϦιʔεͷڞ௨Խ • etc. ͦͷଞͷࢪࡦ 03 ۩ମతͳίετ࠷దԽࢪࡦ
04 ͦͷଞͷऔΓΈ
• ि࣍ఆྫͰͷίετ֬ೝରΞΧϯτΛݶఆ͍ͯ͠ΔͨΊɺ݄࣍ͰΞΧϯτશମͷ ίετਪҠΛݟΔΑ͏ʹ͍ͯ͠Δ(ݱঢ়खಈͷͨΊྑ͍ํ๏Λࡧத) ݄࣍ͰΞΧϯτશମͷίετΛৼΓฦΔ 04 ͦͷଞͷऔΓΈ ຖ݄ ROIΛධՁ
• ։ൃڥಉҰϦιʔε͕ෳ͋Γɺಛੑ͕ҟͳΔͨΊɺCIDͷଞʹNew RelicΛ׆༻ͯ͠ ֤໘ͷར༻ঢ়گݟ͑ΔΑ͏ʹ͍ͯ͠Δ ։ൃڥར༻ঢ়گΛՄࢹԽ͢Δ 04 ͦͷଞͷऔΓΈ
05 ·ͱΊͱࠓޙͷ՝
• CFMϑϨʔϜϫʔΫʹଇΓίετՄࢹԽͷΈΛಋೖͨ͜͠ͱͰɺFinOps࣮ફͷͨΊ ͷୈҰาΛ౿Έग़͢͜ͱ͕Ͱ͖ͨ • ΫΠοΫΟϯ࠷దԽΛ࣮ࢪ͢Δ͜ͱͰظؒͰ$10,000/݄ͷίετΛݮ͢Δ͜ͱʹ ޭͨ͠ ·ͱΊ 05 ·ͱΊͱࠓޙͷ՝
• ύϒϦοΫIPv4ͷ༗ྉԽʹ͏ରԠΛݕ౼/࣮ࢪ͢Δ • αʔϏε͝ͱʹதظతͳΛߟྀͨ͠ίετ࠷దԽࢦඪΛݕ౼͢Δ (ROIΛݟΔ͚ͩͰෛՙରࡦͷͨΊͷϦιʔε૿ڧ࣌ʹਖ਼͘͠ධՁͰ͖ͳ͍) • FinOpsΛ࣮ફ͢ΔͨΊͷΈΛ͍͑ͯ͘ • ίετͷઈର͕େ͖͘ͳ͍Ϧιʔεʹ͍ͭͯ࠷దԽ༨͕͋Δ͔ੳΛߦ͏ •
Savings Plans / Reserved InstanceͷߪೖઓུΛݟ͢ • etc. ࠓޙͷ՝ 05 ·ͱΊͱࠓޙͷ՝
• 20233݄29ൃച • ͲͷΑ͏ʹAWSͷίετ࠷దԽʹऔΓΜͰ͍ͬͨ ΒΑ͍͔ɺΦϯϓϨϛεͷ࣌ͱԿ͕ҧ͏ͷ͔ମ ܥతʹ·ͱ·ΊΒΕ͍ͯΔ • ॳֶऀͷํʹΘ͔Γ͘͢ஸೡʹॻ͔Ε͍ͯΔ ͓͢͢Ίͷॻ੶ 05
·ͱΊͱࠓޙͷ՝ https://www.kadokawa.co.jp/product/322104000266/