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

Amazon EventBridgeでできることをまとめてみた #devio2021

F917158d435891070f86b10eef802a44?s=47 ynishimura
October 05, 2021

Amazon EventBridgeでできることをまとめてみた #devio2021

DevelopersIO Decadeでビデオ登壇するにあたり作成した資料になります。

F917158d435891070f86b10eef802a44?s=128

ynishimura

October 05, 2021
Tweet

Transcript

  1.  ΦϖϨʔγϣϯ෦੢ଜ༞ೋ "NB[PO&WFOU#SJEHFͰ Ͱ͖Δ͜ͱΛ·ͱΊͯΈͨ

  2. ੢ଜ༞ೋ "84ࣄۀຊ෦ΦϖϨʔγϣϯ෦ େࡕΦϑΟεࡏ੶ αʔόʔϨε؀ڥߏங ࣗݾ঺հ  - 2021 APN AWS

    Top Engineer/ APN ALL AWS Certi fi cations Engineer - 2020 APN AWS Top Engineers - 2019 APN AWS Top Engineers
  3. ໨࣍  w"NB[PO&WFOU#SJEHFʹ͍ͭͯ w"NB[PO&WFOU#SJEHFͷશମ૾ɾߏ੒ w"NB[PO&WFOU#SJEHFͷศརͳػೳ ˞࣌఺ͷ৘ใ

  4. ࠓճ࿩͞ͳ͍͜ͱ  wΠϕϯτۦಈΞʔΩςΫνϟͷઃܭʹ͍ͭͯ wϚΠΫϩαʔϏεͷઃܭʹ͍ͭͯ wࣅͨ͜ͱ͕Ͱ͖ΔଞαʔϏεͱͷҧ͍ɾબఆʹ͍ͭͯ

  5. ૝ఆࢹௌऀ  w4BB4΍ෳ਺ͷαʔϏεΛ࿈ܞͨ͠γεςϜΛߏங͍ͨ͠ w"NB[PO&WFOU#SJEHFΛ࢖͍͖͍ͬͯͨ w"NB[PO&WFOU#SJEHFʹ͍ͭͯ஌Γ͍ͨ ΰʔϧ w"NB[PO&WFOU#SJEHFͰͰ͖Δ͜ͱɺ֓ཁΛཧղ

  6.  Amazon EventBridgeͱ͸

  7. "NB[PO&WFOU#SJEHFͱ͸  l"84ɺطଘͷγεςϜɺ·ͨ͸4BB4ΞϓϦશମͰ ΠϕϯτۦಈܕΞϓϦέʔγϣϯΛେن໛ʹߏங͢Δz https://aws.amazon.com/jp/eventbridge/

  8. "NB[PO&WFOU#SJEHFͱ͸  l"84ɺطଘͷγεςϜɺ·ͨ͸4BB4ΞϓϦશମͰ ΠϕϯτۦಈܕΞϓϦέʔγϣϯΛେن໛ʹߏங͢Δz https://aws.amazon.com/jp/eventbridge/ ʰΠϕϯτʱΛ༻͍༷ͯʑͳΞϓϦέʔγϣϯΛ ؆୯ʹ઀ଓͰ͖ΔΑ͏ʹ͢ΔϧʔςΟϯάαʔϏε

  9. Πϝʔδ  ಠࣗ"QQ 4BB4 "84αʔϏε Amazon EventBridge Πϕϯτ ϧʔϧ Πϕϯτιʔε

    λʔήοτ ϧʔϧ ϧʔϧ 4BB4 "84αʔϏε ผ"84؀ڥ Πϕϯτόεʴϧʔϧ Πϕϯτ
  10. "NB[PO&WFOU#SJEHFΛར༻ͨ͠ྫ  ૄ݁߹ʹϚΠΫϩαʔϏεΛ૊ΈཱͯΔ αʔόʔϨεͳϚωʔδυαʔϏεͷͨΊ αʔό४උɾߏஙɾ؅ཧ ʢϚϧν";ɺ4-"ˋʣ

  11.  Amazon EventBridgeͷશମ૾ɾߏ੒

  12. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  13. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  14. Πϕϯτͱ͸  Πϕϯτ͸ঢ়ଶมԽΛද͢ +40/Ͱ΍ΓऔΓ +40/ߏ଄ wEFUBJMUZQFΠϕϯτͷछྨ wTPVSDFΠϕϯτͷૹ৴ݩ wSFTPVSDFTؔ࿈Ϧιʔεͷ഑ྻ wEFUBJMΠϕϯτͷৄࡉσʔλ {

    "version": "0" , "id": "6a7e8feb-b491-4cf7-a9f1-bf3 , "detail-type": "EC2 Instance State , "source": "aws.ec2" , "account": "111122223333" , "time": "2017-12-22T18:43:48Z" , "region": "us-west-1" , "resources": [ "arn:aws:ec2:us-west-1:123456789 ] , "detail": { "instance-id": "i-1234567890abcd , "state": "terminated" } }
  15.  Πϕϯτιʔε

  16. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  17. Πϕϯτιʔε  छྨ Πϕϯτͷछྨ ૹ৴ݩ ૹ৴ઌͷΠϕϯτόε ૹ৴͞ΕΔλΠϛϯά "84αʔϏεͷΠϕϯτ ֤"84αʔϏε σϑΥϧτͷ

    Πϕϯτόε "84αʔϏεͷঢ়ଶ͕ม Θͬͨͱ͖ ֤"84αʔϏε $MPVE5SBJMܦ༝ "84αʔϏεͷ"1*Λݺͼ ग़ͨ͠ͱ͖ ΧελϜΠϕϯτ ΞϓϦέʔγϣϯ ૹ৴࣌ʹࢦఆ &WFOU#SJEHFͷ1VU&WFOUT "1*Λݺͼग़ͨ͠ͱ͖ 4BB4Πϕϯτ 4BB4ΞϓϦέʔγϣϯ ֤4BB4͝ͱʹ࡞੒͞ΕΔ ύʔτφʔΠϕϯτόε 4BB4ΞϓϦέʔγϣϯʹ ΑͬͯҟͳΔ
  18. "84αʔϏε͕ૹ৴͢ΔΠϕϯτ  w&WFOU#SJEHFະαϙʔτͷ৔߹$MPVE5SBJMܦ༝ͷΠϕϯτ औಘՄೳ wσϑΥϧτΠϕϯτόεʹૹ৴ https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-service-event.html &WFOU#SJEHFʹ௚઀ૹ৴͞ΕΔΠϕϯτ "84Ϧιʔεͷঢ়ଶมԽΛى఺ʹΠϕϯτൃੜ $MPVE5SBJMܦ༝Ͱૹ৴͞ΕΔΠϕϯτ "84Ϧιʔεૢ࡞ʢ"1*ݺͼग़͠ʣΛى఺ʹΠϕϯτൃੜ

    Քಇத㱺ఀࢭ Ϣʔβͷૢ࡞Πϕϯτ Πϯελϯεͷঢ়ଶมԽ
  19. ΧελϜΠϕϯτ  w1VU&WFOUT"1*ݺͼग़͠ʹΑͬͯૹ৴ w$-*Ͱ͸BXTFWFOUTQVUFWFOUTίϚϯυͰૹ৴ w֤ݴޠͷ"844%,Λར༻࣮͠૷ wૹ৴ઌͷΠϕϯτόε͸ૹ৴࣌ʹࢦఆՄೳ wະࢦఆͷ৔߹σϑΥϧτΠϕϯτόεʹૹ৴͞ΕΔ https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-putevents.html

  20. ΧελϜΠϕϯτ  1ZUIPOΛ࢖ͬͨΧελϜΠϕϯτΛൃߦ͢Δαϯϓϧ https://dev.classmethod.jp/articles/eventbridge-cross-account-schema-discovery/

  21. 4BB4Πϕϯτ  w4BB4ʹΑΔΠϕϯτ͸֤4BB4ઐ༻ͷΠϕϯτόεʹૹ৴ wૹ৴͞ΕΔΠϕϯτͷछྨ΍λΠϛϯά͸ɺ֤4BB4ΞϓϦ έʔγϣϯͰҟͳΔ wଟ͘ͷ4BB4͕&WFOU#SJEHFʹ౷߹͞Ε͍ͯΔ https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-saas.html https://aws.amazon.com/eventbridge/integrations/

  22. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/shopify-with-eventbridge/

  23.  Πϕϯτόε

  24. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  25. Πϕϯτόεͷछྨ  σϑΥϧτόε ΧελϜόε ύʔτφʔόε ྫʣΠϯελϯε͕ఀࢭͨ͠ ྫʣ஫จػೳ͕஫จΛड͚෇͚ͨ ྫʣSaaSͰ؅ཧ͢Δސ٬৘ใ͕ ߋ৽͞Εͨ

  26.  ϧʔϧ

  27. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  28. ϧʔϧ  wΠϕϯτόεͰड৴ͨ͠ΠϕϯτͰɺͲͷΠϕϯτΛɹɹ λʔήοτʹૹ৴͢Δ͔Λఆٛ͢Δ Πϕϯτύλʔϯ τϥϯεϑΥʔϚʔ λʔήοτ ύλʔϯϚονϯάʹΑΔఆٛ εέδϡʔϧࣜʹΑΔఆٛ JSON

    pathΛ࢖༻ͯ͠ ΠϕϯτΛม׵ λʔήοτϦετ ϧʔϧ͝ͱʹ࠷େ̑ݸࢦఆՄೳ Πϕϯτ
  29. Πϕϯτύλʔϯ  wύλʔϯϚονϯάʹΑΔΠϕϯτͷϑΟϧλʔ wϑΟϧλʔछྨɿ਺஋ɺϓϨϑΟοΫεɺଘࡏνΣοΫͳͲ { "source": ["aws.ec2"] , "detail-type": ["EC2

    Instance State-change Notification"] , "detail": { "state": ["terminated" ] } } https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-event-patterns-content-based- fi ltering.html ྫʣEC2Πϯελϯεͷऴྃʹ͍ͭͯ௨஌Λड͚͍ͨΠϕϯτύλʔϯྫ
  30. Πϕϯτύλʔϯ  wεέδϡʔϧࣜʹΑΔΠϕϯτ࡞੒ wλΠϜκʔϯ65$ɺ࠷খਫ਼౓͸ʮ෼ʯ DSPOࣜ SBUFࣜ ઃఆ஋ͷܗࣜ DSPO <෼><࣌ؒ><೔><݄><༵೔><೥> SBUFT

    <஋><୯Ґ> ઃఆྫ ຖ೔ޕޙ࣌ 65$ ʹ࣮ߦ͢Δ DSPO     ෼͝ͱʹ࣮ߦ͢Δ SBUF NJOVUFT
  31. τϥϯεϑΥʔϚʔ  wೖྗΠϕϯτΛ+40/QBUIͰม׵ https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-transform-target-input.html ड͚औͬͨΠϕϯτ ૹ৴Πϕϯτఆٛ ม਺ఆٛ { "instance" :

    <instance> , "state": <state > } { "version": "0" , "id": "7bf73129-1428-4cd3-a780-95db273d1602" , "detail-type": "EC2 Instance State-change Notification" , "source": "aws.ec2" , "account": "123456789012" , "time": "2015-11-11T21:29:54Z" , "region": "us-east-1" , "resources": [ "arn:aws:ec2:us-east-1:123456789012:instance/i-abcd1111" ] , "detail": { "instance-id": "i-0123456789" , "state": "RUNNING" } } { "instance" : "$.detail.instance-id", "state" : "$.detail.state" } ೖྗͷInstance-id,state Λม਺ʹࢦఆ ม਺Λ࢖ͬͯ λʔήοτʹૹ৴͢Δ ΠϕϯτΛఆٛ ྫʣEC2ͷঢ়ଶมԽͷΠϕϯτ
  32.  ૹ৴ઌλʔήοτ

  33. "NB[PO&WFOU#SJEHFͷશମ૾  https://aws.amazon.com/jp/eventbridge/

  34. λʔήοτ  wΠϕϯτͷૹ৴ઌͱͳΓɺΠϕϯτΛॲཧ͢Δ΋ͷ wͭͷϧʔϧ͋ͨΓͭ·Ͱͷλʔήοτʹૹ৴Մೳ wϦτϥΠઃఆɺ%-2ͷઃఆՄೳ wΠϕϯτอ࣋ظؒɿ࠷େ࣌ؒ wϦτϥΠճ਺ɿ࠷େճ

  35. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/eventbridge-supports- dead-letter-queue/

  36. λʔήοτʹࢦఆͰ͖Δ΋ͷ  wαϙʔτ͞Εͨ"84αʔϏε w"1*%FTUJOBUJPOʢ"1*Ѽઌʣ wผΞΧ΢ϯτͷΠϕϯτόε wผϦʔδϣϯͷΠϕϯτόε https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-targets.html

  37. λʔήοτʹࢦఆͰ͖Δ΋ͷ  wαϙʔτ͞Εͨ"84αʔϏε w"1*%FTUJOBUJPOʢ"1*Ѽઌʣ wผΞΧ΢ϯτͷΠϕϯτόε wผϦʔδϣϯͷΠϕϯτόε https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-targets.html

  38. "1*%FTUJOBUJPOʢ"1*Ѽઌʣ  w೚ҙͷΤϯυϙΠϯτʹ )551ϦΫΤετΛૹ৴ wίʔυͷ࣮૷ෆཁ wηΩϡΞʹೝূ৘ใ؅ཧ wݺͼग़͠Ϩʔτௐ੔Մೳ https://aws.amazon.com/blogs/compute/using-api-destinations-with-amazon-eventbridge/ ਤͷҾ༻ݩ

  39. "1*%FTUJOBUJPOʢ"1*Ѽઌʣͷೝূ  wछྨͷೝূํ๏Λαϙʔτ w#BTJDೝূ w0"VUI$MJFOU$SFEFOUJBMT w"1*,FZ wΫϨσϯγϟϧ͸4FSDSFU.BOBHFSʹอଘ

  40. "1*%FTUJOBUJPOʢ"1*Ѽઌʣͷར༻ྫ  wྫɿTMBDLʹ௨஌͢Δ w-BNCEBΛར༻

  41. "1*%FTUJOBUJPOʢ"1*Ѽઌʣͷར༻ྫ  wྫɿTMBDLʹ௨஌͢Δ SecretsManagerͰೝূ৘ใऔಘ ΠϕϯτͷϖΠϩʔυΛݩʹύϥϝʔλ࡞੒ HTTPϦΫΤετΛૹͬͯΔ͚ͩ

  42. "1*%FTUJOBUJPOʢ"1*Ѽઌʣͷར༻ྫ  wྫɿTMBDLʹ௨஌͢Δ wஔ͖׵͑Δ͜ͱͰ࣮૷ෆཁɺηΩϡΞʹೝূ৘ใ؅ཧ

  43. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/event-bridge-api- destinations-with-slack/

  44. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/try-auth0-api-directly- from-event-bridge-authorization-typeoauth-client-credentials/

  45. λʔήοτʹࢦఆͰ͖Δ΋ͷ  wαϙʔτ͞Εͨ"84αʔϏε w"1*%FTUJOBUJPOʢ"1*Ѽઌʣ wผΞΧ΢ϯτͷΠϕϯτόε wผϦʔδϣϯͷΠϕϯτόε https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-targets.html

  46. λʔήοτʹผΞΧ΢ϯτͷΠϕϯτόεΛࢦఆ  ΫϩεΞΧ΢ϯτ࿈ܞ wૄ݁߹ʹ࿈ܞͰ͖Δ

  47. λʔήοτʹผΞΧ΢ϯτͷΠϕϯτόεΛࢦఆ  ΫϩεΞΧ΢ϯτ࿈ܞ wૄ݁߹ʹ࿈ܞͰ͖Δ ࣗ਎͕ଘࡏ͢ΔAWSΞΧ΢ϯτͷ EventBridgeͷΈҙࣝ͢Ε͹Α͍

  48. λʔήοτʹผΞΧ΢ϯτͷΠϕϯτόεΛࢦఆ  ΫϩεΞΧ΢ϯτ࿈ܞ wૄ݁߹ʹ࿈ܞͰ͖Δ ґଘؔ܎͕EventBridgeʹด͡Δ

  49. λʔήοτʹࢦఆͰ͖Δ΋ͷ  wαϙʔτ͞Εͨ"84αʔϏε w"1*%FTUJOBUJPOʢ"1*Ѽઌʣ wผΞΧ΢ϯτͷΠϕϯτόε wผϦʔδϣϯͷΠϕϯτόε https://docs.aws.amazon.com/ja_jp/eventbridge/latest/userguide/eb-targets.html

  50. λʔήοτʹผϦʔδϣϯͷΠϕϯτόε  ϦʔδϣϯؒͷΠϕϯτసૹʹΑΔΠϕϯτू໿ wಉҰΞΧ΢ϯτ಺ͷΠϕϯτू໿ wड৴ՄೳͳϦʔδϣϯ wόʔδχΞɺΦϨΰϯɺΞΠϧϥϯυ https://aws.amazon.com/jp/blogs/compute/introducing-cross-region-event-routing-with-amazon- eventbridge/ ਤͷҾ༻ݩ

  51. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/amazon- eventbridge-introduces-support-cross-region-event- bus-targets/

  52.  Amazon EventBridgeͷศརͳػೳ

  53. 4DIFNB3FHJTUSZ  w&WFOU#SJEHFͰ΍ΓऔΓ͞ΕΔ༷ʑͳσʔλͷεΩʔϚΛ ؅ཧ w0QFO"1* +40/4DIFNB%SBGUͰอଘՄೳ wεΩʔϚͷόʔδϣϯ؅ཧՄೳ Jsonߏ଄ɺϓϩύςΟͷҰཡ΍ܕ৘ใΛ؅ཧ

  54. 4DIFNB3FHJTUSZ  w&WFOU#SJEHFͰ΍ΓऔΓ͞ΕΔ༷ʑͳσʔλͷεΩʔϚΛ ؅ཧ w0QFO"1* +40/4DIFNB%SBGUͰอଘՄೳ wεΩʔϚͷόʔδϣϯ؅ཧՄೳ Exportͯ͠όϦσʔγϣϯʹར༻Ͱ͖Δ

  55. +40/4DIFNB  w࣮ߦ࣌ͷόϦσʔγϣϯ͕Մೳ https://dev.classmethod.jp/articles/json-validation/

  56. 4DIFNB%JTDPWFSZ  w&WFOU#SJEHFͰड͚औͬͨ4BB4Πϕϯτ΍ΧελϜΠϕϯτ ͷεΩʔϚΛ0QFO"1*ܗࣜͰࣗಈอଘ

  57. $PEF#JOEJOHT  w"845PPMLJUGPS*OUFMMJ+ 7JTVBM4UVEJP$PEFΛ༻͍ͯ εΩʔϚఆٛΛऔಘՄೳ w+BWB 1ZUIPO 5ZQF4DSJQU ʹରԠ w࣮૷࣌ͷίʔυิ׬΍ίϯύΠϧ࣌ͷΤϥʔݕग़ʹར༻

  58. 3FQMBZ"SDIJWFػೳ  w"SDIJWFɿࢦఆͨ͠ύλʔϯͷΠϕϯτΛอଘ w3FQMBZɿ"SDIJWFͨ͠ΠϕϯτΛ࠶ੜ wઃఆͨ͠ϧʔϧɺλʔήοτͷಈ࡞֬ೝ͕༰қʹ

  59. ΍ͬͯΈͨϒϩάͷ঺հ  https://dev.classmethod.jp/articles/ eventbridge-record-createaccount-event/ https://dev.classmethod.jp/articles/ amazon-eventbridge-archive-replay/

  60.  ·ͱΊ

  61. ·ͱΊ  "NB[PO&WFOU#SJEHF wαʔόʔ؅ཧෆཁͰΠϕϯτόε͕ར༻ w࣮૷ͳ͠Ͱ"84αʔϏεɺ4BB4ͳͲΞϓϦΛ࿈ܞ wૄ݁߹ͳΠϕϯτۦಈΞʔΩςΫνϟͷߏங͕༰қ wΠϕϯτεΩʔϚͷࣗಈݕ஌ɺอଘɺ؅ཧ w։ൃΛޮ཰Λ্͛Δศརͳػೳ͕ͨ͘͞Μ͋Δ

  62.  ࢀߟࢿྉ

  63. ࢀߟࢿྉ  https://www.slideshare.net/AmazonWebServicesJapan/20210127-aws-expert-online-13-241967722 https://pages.awscloud.com/rs/112-TZM-766/images/DevAx_connect_day7_SaaS_integration_shared.pdf https://pages.awscloud.com/rs/112-TZM-766/images/ Amazon%20EventBridge%20%E3%81%AE%E4%BE%BF%E5%88%A9%E3%81%AA%E6%A9% 9F%E8%83%BD%20%2B%20%E6%96%B0%E6%A9%9F%E8%83%BD.pdf https://d1.awsstatic.com/webinars/jp/pdf/services/20200122_BlackBelt_EventBridge.pdf On-demand γʔζϯ

    1ʮΠϕϯτۦಈʯ https://aws.amazon.com/jp/devax-connect-on-demand/
  64. None