Laying Groundwork For Alerting With Simple Notification Service
Contents
In this post we’ll be setting up Amazon Simple Notification System (SNS) to enable it to email me in response to an alarm I’m going to be setting up. SNS uses two principles to operate:
- Topics, which is what messages are about
- Subscriptions, which is where the messages are going and how they will be sent
So a topic might be a report failure, and the subscriptions associated with the topic might be the report owner’s email address, the Service Desk website and the Out Of Hours mobile number.
Let’s get started! The first step will be to switch regions to N. Virginia (US-East-1). This is because the SNS I’m setting up here will be used for a billing alert we’ll be setting up next time, and the billing data is only available in N. Virginia. When setting up an SNS topic it must be created in the same region as the resource using it - in this case that’s the billing data although it could just as easily be an EC2 instance, CloudWatch alarm etc.
Once that’s done, search for SNS in the console.
The Amazon SNS dashboard will load. This screen shows all current topics and subscriptions, but as I want to create a new one I’ll load the Amazon SNS main page:
From here a new topic can be created, starting with the name:
In my example I’m using Provider_Account_Region_Function_Service
. We then move to the Create Topic screen where many features (all optional) are presented. I won’t be using any of them for now, although I will apply some tags:
The next step is to create a subscription for the topic. There are several ways to do this - here I’ll navigate to Subscriptions and click the Create Subscription button
I am asked to specify a protocol. This is how SNS will deliver messages, and there’s lots to choose from:
I’ll select Email, and am prompted for an email address. AWS will not send anything to this email address until it is confirmed - in the case of email this involves an email automatically being sent to the address specified:
Until this process is complete, the subscription status will show as Pending Confirmation:
When the owner of the email account clicks the Confirm Subscription link they are informed that their subscription is confirmed:
And the subscription status changes to Confirmed
All done! Next time we’ll be using our new SNS topic to set up some billing alerts.
Thanks for reading ~~^~~
Author Damien Jones
LastMod 2019-10-22