hands-on lab

Reacting to Source Control Events with AWS Lambda

Difficulty: Beginner
Duration: Up to 2 hours
Students: 5,007
Rating: 4.4/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

A common use case for AWS Lambda functions is to process events from platforms such as source control management (SCM) systems.

Actionable events from source control management systems include:

  • Pushing new code
  • Creating new branches
  • Creating tags
  • Merging branches

Reacting to these events enables you to send notifications, integrate with third-party services, or implement custom logic.

In this lab, you will learn how to process source control events with a Lambda function. As a simple example, you will use Python to create custom SNS notifications, containing useful information about branches and messages for each commit.

Learning Objectives

Upon completion of this beginner-level lab, you will be able to:

  • Create an SNS topic and a subscription
  • Implement a Lambda function to process source control events
  • Test that your Lambda function processes events and sends a notification

Intended Audience

  • Developers
  • Cloud Engineers

Prerequisites

You should have a conceptual understanding of source control.

This lab involves sending email notifications, you will need an email address you can check to complete the lab.

Familiarity with the following will be beneficial but is not required:

  • Python programming language
  • Linux command-line
  • Publish/Subscribe asynchronous messaging 

The following courses can be used to fulfill the prerequisites:

Updates

October 23rd, 2024 - Replaced CodeCommit with Gitea

January 10th, 2022 - Corrected grammatical error

November 15th, 2021 - Added a reminder to ensure the correct region is used

March 9th, 2021 - Updated AWS Lambda lab steps to reflect latest user interface updates

January 22nd, 2021 - Updated AWS Lambda lab steps to reflect latest user interface updates

June 3rd, 2020 - All screenshots and instructions updated

January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab

Environment before

Environment after

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Creating an Amazon SNS Topic and Subscription
Processing Source Control Events With AWS Lambda
Testing Your AWS Lambda Trigger