Introduction
This lab will consist of creating a new AWS CodeCommit repository and adding our source control. We will use a trigger in CodeCommit to listen for any new commit to our source code to trigger an email notification via Amazon Simple Notification Service (SNS).
In this lab, I am taking the role of a developer. I am going to commit code changes to AWS CodeCommit, and everytime I commit a change to AWS CodeCommit, my quality assurance team would like to be informed of the commit. So what I am going to do is set up an event that will listen to code commits to the AWS CodeCommit Repository. This event will trigger Amazon Simple Notification Service (SNS) to send an email to the quality assurance team so that they are informed of the changes I have made to CodeCommit.
Create a CodeCommit Repository
● Log into the AWS Management Console as an IAM User
● Open the CodeCommit console.
● On the Repositories page, click Create repository.
● On the Create repository page, set the following values:
● Repository name: DevOpsRepo
● Description: Leave as default.
● Click Create.
Create an Amazon SNS topic
● Navigate to Amazon SNS.
● On the homepage, enter the topic name CodeCommitDev in the Create Topic section.
● Click Next step.
● On the Create topic page, select the Standard option and leave everything else as the default.
● Click Create topic.
Subscribe to the Topic
● From the CodeCommitDev page, click Create subscription.
● On the Create subscriptions page, set the following values:
● Protocol: Email
● Endpoint: amehmathiasejeh40@gmail.com
● Click Create subscription to send a confirmation message to the registered email.
● Open the AWS Subscription Confirmation email and click Confirm subscription.
● Return to the Amazon SNS page and check that the confirmation went through.
Create an Event
● Navigate to EventBridge.
● On the landing page, under Get Started on the right side of the page, ensure the EventBridge Rule is selected and click Create Rule.
● On the Create rule page, set the following values:
● Name: codecommitrule
● Event bus:default
● Select Rule with an event pattern
● Click Next.
● In the Event source, select AWS events or EventBridge partner events.
● In the Event Pattern section, choose the Event source of AWS Services.
● Choose the CodeCommit service.
● Choose the event type of All Events.
● Click Next.
● Choose the Target type of AWS service.
● Select a target of SNS topic.
● Choose your Topic name.
● Click Next.
● Click Next.
● Click Create rule.
Add a File to the Repository
● Navigate back to CodeCommit.
● On the Repositories page, select the newly created repository.
● Click Add file > Upload file.
● Upload a file from your local computer.
● In the Commit changes to master section, set the following values:
● Author name: Ameh Mathias Ejeh
● Email address: amehmathiasejeh40@gmail.com
● Click Commit changes.
● Check your email to see if you received a notification of a change to the repository.
Key Workflow Steps
- Developer Commits Code: A developer pushes code changes to the AWS CodeCommit repository.
- Event Detection: An event is triggered within AWS CodeCommit to detect the new commit.
- Notification Dispatch: The event triggers an Amazon SNS topic, which sends notifications to the QA team.
- Notification Received: QA team members receive the notification via email and proceed with the review
Top comments (0)