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 our 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
- Open the CodeCommit console.
- On the Repositories page, click Create repository.
- On the Create Repositories page, set the following values:
- Repository name: CloudWatchTriggerSNS
- Description: A test CodeCommit repository.
- Click Create.
Add an
index.html
File to the Repository- On the Repositories page, select the newly created repository.
- Click Add file > Upload file and select the
index.html
file from your local computer. - In the Commit changes to master section, set the following values:
- Author name: Your name.
- Email address: Your email address
- Commit message: Updated website
- Click Commit changes.
- Create an Amazon SNS Topic
- Navigate to Amazon SNS.
- On the homepage, enter the topic name in the Create Topic section and click Next step.
- On the Create topic page, enter the topic name in Display Name to use the topic with SMS subscriptions.
- Leave the rest as their defaults and click Create topic.
- Subscribe to the Topic
- From the Subscriptions page, click Create subscription.
- On the Create subscriptions page, set the following values:
- Protocol: Email
- Endpoint: Enter your email address
- Click Create subscription to send a confirmation message to the registered email.
- Open the AWS Subscription Confirmation email and click Confirm subscription.
- Create a Topic Trigger
- Navigate to AWS CodeCommit.
- From the Repository page, select the newly created repository.
- From the left menu, click Source > Settings.
- Click Triggers > Create trigger.
- 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
- Click Create Trigger.