Skip to content

Create Email NotificatioN (AWS, OLD)

Clemens H. Cap edited this page Jun 26, 2024 · 1 revision

Table of Contents

Goal

We want to provide a mechanism for receiving an email as notification as soon as specific events occur in the build process.

Define Notification Mechanism

  • Open AWS SNS console
  • Ensure you are in the correct region
  • On the left, navigate to Topics
  • Create topic of type "Standard"
  • Write down the ARN of the topic. We might want to create 3 topics for flexibility.
    • arn:aws:sns:eu-central-1:499754002549:BuildFailed
    • arn:aws:sns:eu-central-1:499754002549:BuildSucceeded
    • arn:aws:sns:eu-central-1:499754002549:BuildTopic
  • On the left, navigate to Subscriptions
  • Create subscription
  • Protocol: Select "email"
  • Enter endpoint email address.
  • Click "Create subscription"
  • Read at the respective email address.
  • Click "Confirm subscription"

Define Event Rules

  • Open AWS CloudWatch console
  • Ensure you are in the correct region
  • On the left, navigate to Events->Rules
  • Create Rule
    • Event Source: Event Pattern
    • Service Name: "CodeBuild"
    • Add Target:
      • SNS topic
      • Pick the topic just defined, for example for BuildTopic we could use:
  {"build-status":"$.detail.build-status","project-name":"$.detail.project-name","build-id":"$.detail.build-id"}
  "Build '<build-id>' for build project '<project-name>' has reached the build status of '<build-status>'."

References