Creating an AWS CodeCommit Repository That Triggers Email Notifications

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

AWS CodeCommit is a fully managed source control service that hosts secure Git-based repositories. It makes it easy for teams to collaborate on code in a secure and highly scalable ecosystem. CodeCommit eliminates the need to operate your own source control system or worry about scaling its infrastructure. You can use CodeCommit to securely store anything from source code to binaries, and it works seamlessly with your existing Git tools. This lab will consist of creating a new AWS CodeCommit repository and adding source control. We will use Amazon CloudWatch to listen for any new commit to our source code to trigger an email notification via AWS Simple Notification Service (SNS).

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a CodeCommit Repository
  1. Open the CodeCommit console.
  2. On the Repositories page, click Create repository.
  3. On the Create Repositories page, set the following values:
    • Repository name: CloudWatchTriggerSNS
    • Description: A test CodeCommit repository.
  4. Click Create.

Add an index.html File to the Repository

  1. On the Repositories page, select the newly created repository.
  2. Click Add file > Upload file and select the index.html file from your local computer.
  3. In the Commit changes to master section, set the following values:
    • Author name: Your name.
    • Email address: Your email address
    • Commit message: Updated website
  4. Click Commit changes.
Create an Amazon SNS Topic
  1. Navigate to Amazon SNS.
  2. On the homepage, enter the topic name in the Create Topic section and click Next step.
  3. On the Create topic page, enter the topic name in Display Name to use the topic with SMS subscriptions.
  4. Leave the rest as their defaults and click Create topic.
Subscribe to the Topic
  1. From the Subscriptions page, click Create subscription.
  2. On the Create subscriptions page, set the following values:
    • Protocol: Email
    • Endpoint: Enter your email address
  3. Click Create subscription to send a confirmation message to the registered email.
  4. Open the AWS Subscription Confirmation email and click Confirm subscription.
Create a Topic Trigger
  1. Navigate to AWS CodeCommit.
  2. From the Repository page, select the newly created repository.
  3. From the left menu, click Source > Settings.
  4. Click Triggers > Create trigger.
  5. On the Create trigger page, set the following values:
    • Trigger name: triggerUponRepoChange
    • Events: Push to existing branch
    • Branch names: master
    • Service details: Amazon SNS
    • SNS topic: Your trigger name
  6. Click Create Trigger.

Additional Resources

In this lab scenario, our QA team says they are not being properly notified each time there is a code commit to the source code repository. To remedy this, the DevOps team plans to have Amazon CloudWatch monitor changes to our source code repository and trigger an email notification to the QA team.

Log in with the credentials provided and make sure you are in the us-east-1 region.

You can find the index.html file used for this lab in the GitHub repository.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!