Upgrade to Pro — share decks privately, control downloads, hide ads and more …

初心者でもそうじゃない人も CloudWatch を使ってみよう

初心者でもそうじゃない人も CloudWatch を使ってみよう

いろいろな監視サービスを渡り歩いて、どのサービスも一長一短あるけれど、ひとまず CloudWatch で監視を始めるのもいいと思いました。

その経緯についてお話ししました。

Katz Ueno

July 11, 2023
Tweet

More Decks by Katz Ueno

Other Decks in Technology

Transcript

  1. Katz Ueno (@katzueno) JAWS-UG ໊ݹ԰, 2023.7.11 How I ended up

    with CloudWatch (+α) after using several services 1 ॳ৺ऀͷਓͰ΋ɺ
 ͦ͏ͯͳ͍ਓ΋ CloudWatch Λ࢖ͬͯΈΑ͏+α
  2. ࠓ೔ͷݴ͍͍ͨ͜ͱ My bottom lines of the day • ଞࣾͷΦϒβόϏϦςΟαʔϏε͸ศར •

    ͖ͪΜͱઃܭ͠ͳ͍ͱ௧͍໨ʹૺ͏͓͔͔ۚ͠Δ • CloudWatch ϝτϦΫεɺϩάɺAthena Ͱ݁ߏ͍͚Δ
  3. ΧϨʔ 🍛 Ϛϥιϯ🏃݄ؒ400km, ंதധ, ϥΠϒ഑৴, ಈը੍࡞ ΞϚνϡΞແઢ4ڃ (1993) / TOEIC

    990 (2013) / AWS SAA (2017~) CloudFront, S3, IVS, CloudWatch 4 Katz Ueno (Χπ - ্໺উ೭) Concrete CMS ࢖͍ CMS ͱΠϯϑϥ΍ͬͯ·͢ SNS: Twitter @katzueno / Instagram @katzueno & @katzcurry / Blog: katzueno.com ίϛϡχςΟ Cncrete CMS Japan / CoderDojo ඌு / JAWS UG ໊ݹ԰ ޷͖ͳ৯΂෺: झຯ: ࢿ֨: ޷͖ͳαʔϏε:
  4. ࠓ೔ͷΞδΣϯμ Today’s agenda • CloudWatch ·Ͱͷวྺ • ֤αʔϏεͰͷར఺ɾܽ఺
 (+ࣦഊஊ) •

    CloudWatch (+Athena) Ͱ͍͍ ͡ΌΜ • ͓·͚: SRE ࢧ෦ͷ঺հ Stable Di ff usion Ͱ “Agenda” Ͱੜ੒
  5. Katz ͷΦϒβϏϦςΟͷεϖοΫ • 3rd Party • Mackerel (2014~): ͘͞Β VPS

    Ͱར༻։࢝ • New Relic (2016~): AWSར༻ऀ͸ແྉͷ࣌୅ • Datadog (2021~): • AWS (CloudWatch ྺ): 2016~ • EC2, RDS த৺ɻίϯςφ͸ະͩɻ ͭ·Γɺ͠ΐ΅͍Ͱ͢ 😅 😅 😅 ඞཁʹԠͯ͡ ࠷௿ݶ͔͠ ׆༻ͯ͠ͳ͍ 😅😅😅😅😅
  6. New Relic • 2008೥૑ۀ • AWS αʔόʔ಺ͩͬͨΒແྉ ͩͬͨ • APM

    (Application Performance Management) αʔϏε͕͋Δʂ
  7. New Relic Katz ͸ • ͓٬͞Μ CMS Ҋ݅ • ղܾ͔ͨͬͨ͠՝୊

    
 PHP Τϥʔɾॲཧ଎౓ͷ؂ࢹ • 2015~2021 ͰϝΠϯͰ࢖͏
  8. New Relic ྑ͍ͱ͜Ζ • APM ศརʂ • Τϥʔ΋Θ͔Δʂ • Ͳ͜Ͱॲཧʹ͔͔࣌ؒͬͯΔ͔Θ͔

    Δʂ ෆຬͳͱ͜Ζ • ΤʔδΣϯτ͕ॏ͍ (ޙड़) • ྉۚߴ͍
  9. New Relic ৽ͨͳ՝୊ (౰࣌) • AWSϢʔβʔແྉͩͬͨྉ͕ۚ༗ྉʹͳͬͨ (APM+Πϯϑϥ) • (New Relic

    ͕ѱ͘ͳ͍͚ΕͲ) ͓ۚΛ෷͏෼ͷରՁ͋Δʁ • ෼ੳ͢Δ͕࣌ؒແ͍ • agent ͷύϑΥʔϚϯεϩε͕େ͖͔ͬͨ (ޙड़)
  10. Datadog Katz ͸ • ͓٬͞Μ CMS Ҋ݅ • ղܾ͔ͨͬͨ͠՝୊ 


    New Relic ͷ஗͍ΤʔδΣϯτ • 2021~ ࢖͍࢝ΊΔ
  11. Datadog ྑ͍ͱ͜Ζ • ؅ཧը໘͕Έ΍͍͢ (૬ੑ?) • ΤʔδΣϯτ͕͍ܰ (?) • Τϥʔݕࡧ͕؆୯

    ෆຬͳͱ͜Ζ • ͦΕͰ΋ΤʔδΣϯτ͕ॏ͍ (ޙड़) • Data Injection Ϧϛοτग़ݱ😢
  12. Datadog ྑ͍ͱ͜Ζ • ؅ཧը໘͕Έ΍͍͢ (૬ੑ?) • ΤʔδΣϯτ͕͍ܰ (?) • Τϥʔݕࡧ͕؆୯

    ෆຬͳͱ͜Ζ • ͦΕͰ΋ΤʔδΣϯτ͕ॏ͍ (ޙड़) • Data Injection Ϧϛοτग़ݱ😢
  13. Datadog ྑ͍ͱ͜Ζ • ؅ཧը໘͕Έ΍͍͢ (૬ੑ?) • ΤʔδΣϯτ͕͍ܰ (?) • Τϥʔݕࡧ͕؆୯

    ෆຬͳͱ͜Ζ • ͦΕͰ΋ΤʔδΣϯτ͕ॏ͍ (ޙड़) • Data Injection Ϧϛοτग़ݱ😢
  14. Datadog ྑ͍ͱ͜Ζ • ؅ཧը໘͕Έ΍͍͢ (૬ੑ?) • ΤʔδΣϯτ͕͍ܰ (?) • Τϥʔݕࡧ͕؆୯

    ෆຬͳͱ͜Ζ • ͦΕͰ΋ΤʔδΣϯτ͕ॏ͍ (ޙड़) • Data Injection Ϧϛοτग़ݱ😢 27TB!!! ͝ΊΜͳ͞ʔʔʔ͍
  15. New Relic & Datadog ΤʔδΣϯτͷࣦഊ ྆αʔϏεͱ΋ѱ͘ͳ͍ (?) • ΤʔδΣϯτͷϦιʔεফඅΛܭࢉͯ͠ͳ͔ͬͨ😅 •

    ෛՙςετ͸ΤʔδΣϯτΠϯετʔϧલ • ຊ൪ӡ༻։࢝ͨ͠ޙʹΠϯετʔϧ • CPU, ϝϞϦΛ࠷େݶʹ׆͔ͨ͢ΊͷνϡʔχϯάΛ͍ͯͨ͠ • ຊ൪Ͱӡ༻։࢝ͨ͠ࡍʹɺෛՙΦʔόʔͰΤϥʔଟൃ😭😭😭😭😭 • ͡Ό͋ࢼݧʁ → ։ൃɾݕূ؀ڥͷͨΊʹ՝ۚΛ૿΍ͨ͘͠ͳ͍
  16. ͱΓ͓֮͋͑ͣ͑ͯ͜͏ • CloudWatch Metrics & Dashboard • CloudWatch Logs •

    CloudWatch Alarm • Athena (ELB & CloudFront ͱ͔)
  17. CloudWatch Ͱे෼͔΋ʁ ࠷ॳଆඋΘͬͯΔ͠ • গͳ͍අ༻Ͱ࢝ΊΒΕΔɿैྔ՝ۚ • ͦ΋ͦ΋ඪ४ͰϝτϦΫε͍ͭͯΔ • CloudWatch ϩά

    -> ΦʔτεέʔϦϯάΠϯελϯ εͳͲͩͱݕࡧָ͕ • (Amazon Linux) ͸ΤʔδΣϯτΠϯετʔϧؾܰ
  18. AWS Athena Ͱϩάղੳʂ • SQL ΫΤϦͷྫ:
 
 7/11 ʹ CloudFront

    Distribution ʹΞΫηεͨ͠ IP ΞυϨεͷଟ͍ॱΛݕࡧ͢Δ SQL SELECT client_ip, x_edge_location, count(*) AS num FROM cf_log WHERE request_date = '2023-07-11' GROUP BY 1,2 ORDER BY count(*) DESC LIMIT 100;
  19. AWS Athena Ͱϩάղੳʂ • SQL ΫΤϦͷྫ:
 
 7/11 ʹ CloudFront

    Distribution ʹΞΫηεͨ͠ IP ΞυϨεͷଟ͍ॱΛݕࡧ͢Δ SQL SELECT client_ip, x_edge_location, count(*) AS num FROM cf_log WHERE request_date = '2023-07-11' GROUP BY 1,2 ORDER BY count(*) DESC LIMIT 100;
  20. ࠓ೔ͷݴ͍͍ͨ͜ͱ My bottom lines of the day • ଞࣾͷΦϒβόϏϦςΟαʔϏε͸ศར •

    ͖ͪΜͱઃܭ͠ͳ͍ͱ௧͍໨ʹૺ͏͓͔͔ۚ͠Δ • CloudWatch ϝτϦΫεɺϩάɺAthena Ͱ݁ߏ͍͚Δ • ͏·͘ӡ༻͢Ε͹અ໿Ͱ͖Δʂ • ؅ཧը໘ઃܭ΋ CDK ͱ͔Ͱ࡞ΕΔ (ܭըத)
  21. ࠓ೔ͷݴ͍͍ͨ͜ͱ My bottom lines of the day • ͻͱ·ͣ΍ͬͯΈΔ͜ͱ •

    CloudWatch Dashboard Λ࡞ͬͯΈΔ • CloudWatch Logs ʹϩάΛૹͬͯݕࡧͰ͖ΔΑ͏ʹͯ͠ΈΔ
  22. JAWS UG SRE ࢧ෦ #6 2023/5/29 0:00:00 Φʔϓχϯά SREࢧ෦ ΈͷΔΜ

    @minorun365 0:05:05 ΞΠεϒϨΠΫLT SREࢧ෦ ;Δ΍ @saramune 0:09:14 ʮΤϯδχΞϦϯάͰӡ༻Λվળ͢ΔʯͨΊͷAmazon CloudWatch׆༻ ΞϚκϯ΢ΣϒαʔϏεδϟ ύϯ߹ಉձࣾɹ௡ڷ ޫ໌ @misstuu 0:39:50 શAWSΤϯδχΞʹ๋͙ɺCloudWatch ઃܭɾӡ༻ ދͷר ΞϥΠͱ΢ϚΧπ @msy78 @HorseVictory 1:03:40 Amazon CloudWatch SyntheticsͰ࢝ΊΔ֎ܗ؂ࢹʢԾʣ SREϗʔϧσΟϯάε 佂ా ߁ฏ @boy_hap 1:12:50 CloudWatchͰόϨΔʮ܅ɺ࢓ࣄதʹyoʓtube؍ͯͨΑͶʁʯ Ϋϥ΢υηϯτϦοΫ ֯த ݯଠ࿠ @kado__gen 1:21:43 CloudWatchෳ߹ΞϥʔϜͰELBͷ5XXΛ͍͍ײ͡ʹݕ஌͠Α͏ͱͨ͠Β͏·͍͔͘ͳ͔ͬͨ࿩ k.goto @365_step_tech 1:32:36 CloudWatchΛݸਓ৘ใอޢͷ໡఺ʹ͠ͳ͍ͨΊʹ גࣜձࣾΩϟϯαʔεΩϟϯ อࡔ কฏ @shoheihosaka •
  23. ΧϨʔ 🍛 Ϛϥιϯ🏃݄ؒ400km, ंதധ, ϥΠϒ഑৴, ಈը੍࡞ ΞϚνϡΞແઢ4ڃ (1993) / TOEIC

    990 (2013) / AWS SAA (2017~) CloudFront, S3, IVS, CloudWatch 63 Katz Ueno (Χπ - ্໺উ೭) Concrete CMS ࢖͍ CMS ͱΠϯϑϥ΍ͬͯ·͢ SNS: Twitter @katzueno / Instagram @katzueno & @katzcurry / Blog: katzueno.com ίϛϡχςΟ Cncrete CMS Japan / CoderDojo ඌு / JAWS UG ໊ݹ԰ ޷͖ͳ৯΂෺: झຯ: ࢿ֨: ޷͖ͳαʔϏε: