Creating and Subscribing to an SNS Topic
You now have static analysis of your IaC integrated into your continuous integration pipeline. The problem now is that you would never know the build failed unless you go to the Jenkins page. You will add alerting to automatically notify you of the build result.
Jenkins has a variety of plugins to support a range of notification requirements. For example, Jenkins can directly send emails, or post a message to a Slack channel. You will configure Jenkins to publish a message to an Amazon Simple Notification Service (SNS) topic. You will create the SNS topic and subscribe to it using your email address in this Lab Step.
1. In the AWS Management Console search bar, enter SNS, and click the Simple Notification Service result under Services:
2. If you see the following welcome page, click Topics on the left-side menu:
3. Click Create topic:
4. In the Create new topic form, enter the following values and click Create topic:
- Type: Standard
- Name: build-results
- Display name: build
5. Copy the Amazon Resource Name (ARN) in the Topic details:
You need the ARN in order to identify the topic you want to subscribe to.
6. From the Topic dashboard, click Create subscription:
7. In the Create subscription form, enter the following values and click Create subscription:
- Protocol: Email
- Endpoint: Enter your valid email address (for example, email@example.com).
8. Notice that the subscription is pending confirmation in the Topic details page:
9. Open your email client. Find and open the new email from the SNS topic you created; AWS Notification is part of the the subject line:
10. Click the Confirm subscription link:
You will see a Subscription confirmed screen similar to the following:
11. Return to the Topic details page for the SNS topic you created earlier.
Notice the Subscription ARN changed from PendingConfirmation to the actual Subscription ID.
In this Lab Step, you created and subscribed to an SNS topic that will be used to receive build notifications.
Check that the SNS topic has been created