Skip to Content
Technical Articles

Receive Notifications from Amazon Simple Notification Service with SAP Cloud Platform Alert Notification

Do you maintain resources in AWS? And you also manage applications and services in SAP Cloud Platform? Have you ever thought whether it’s possible to have a common alerting mechanism for your end-to-end solution? The answer is “Yes, it’s now possible”.  SAP Cloud Platform Alert Notification is the common alerting tool in SAP Cloud Platform and Amazon Simple Notification Service is the one in AWS. They are now integrated!

Today, we’ll focus on how Amazon Simple Notification Service (referred to as Amazon SNS) could forward information from a topic towards SAP Cloud Platform Alert Notification  (referred to as Alert Notification). For this purpose, we will create and set up a topic in Amazon SNS, we will publish a simple message to it and finally we will receive it as an e-mail message from Alert Notification.

As prerequisites, two points are needed before starting:

  • An active license or subscription for SAP Cloud Platform Alert Notification; if not, Discover the service;
  • An Active account in AWS.

 

Set up SAP Cloud Platform Alert Notification


Let’s start by configuring SAP Cloud Platform Alert Notification. To achieve our scenario, we need a couple of steps to prepare:

  • get credentials that will be used from Amazon SNS to authorize against Alert Notification;
  • instruct Alert Notification to send us an e-mail for each notification received from Amazon SNS.

Starting by the credentials, let’s navigate to our Alert Notification instance within the SAP Cloud Cockpit, then go to the Security menu (for Neo accounts) or to the Service Keys menu (for Cloud Foundry accounts). Now we are ready to create a credentials pair of type BASIC authentication that has the ALERT_WRITE permission. To achieve this, do the following according to your environment:

  • for Neo, follow the steps described here
  • for Cloud Foundry, follow the steps described here

Note: Once, the credential pair is created, make sure to save the client id and client secret in a secure place, so that we could use them later while configuring Amazon SNS.

Next, let’s set up Alert Notification to match any notification coming from Amazon SNS and send it to our email address. To achieve it, we’ll import a predefined action, condition and a subscription:

Note: Before importing, ensure you’ve replaced the e-mail address placeholder.

{
  "conditions": [
    {
      "name": "AllAmazonSNSEvents",
      "propertyKey": "eventType",
      "predicate": "STARTS_WITH",
      "propertyValue": "AmazonSNS"
    }
  ],
  "actions": [
    {
      "name": "NotifyMeByEmail",
      "state": "ENABLED",
      "destination": "<your.email@here>",
      "type": "EMAIL"
    }
  ],
  "subscriptions": [
    {
      "name": "AllAmazonSNSEventsToMyEmail",
      "conditions": [
        "AllAmazonSNSEvents"
      ],
      "actions": [
        "NotifyMeByEmail"
      ],
      "state": "ENABLED"
    }
  ]
}

Once the import is completed, check the provided email address – an automatic message containing a confirmation link will be delivered. Make sure to confirm the action.

 

Set up Amazon Simple Notification Service


It’s time to configure Amazon SNS to forward messages to Alert Notification. Firstly, we should create a topic and then create a subscription in this topic:

  1. In the AWS Console look up for Simple Notification Service and select it
  2. Navigate to Topics
  3. Click on Create topic
  4. Fulfill needed Details and click on Create topic button at the bottom
  5. In the newly created topic view, click on Create subscription
  6. Choose HTTPS protocol
  7. Fulfill the Endpoint using the template below and replace the placeholders as follows:
https://<username>:<password>@<base-url>/<environment>/producer/v1/resource-events?schema_definition=aws_sns_message&version=1
    • replace <username> with the URL-encoded value of the client ID received upon creation of Alert Notification credentials in the previous section;
    • replace <password> with the URL-encoded value of the client secret received upon creation of Alert Notification credentials in the previous section;
    • replace <base-url> with the value of the url property in your service key (for Cloud Foundry environment) or with the Base URL available in the Security view in Neo accounts;
    • replace <environment> with cf for Cloud Foundry environment or with neo for Neo environment.

Once the subscription is created, an automatic email will be delivered to the previously provided address. It is sent by Amazon SNS with confirmation purpose. Follow the link in the SubscribeURL event tag:

Having this subscription confirmed, we’re ready to start our demo scenario. Moreover, from now on we’re going to receive any message published to this topic over our Alert Notification instance.

Execute the scenario


Let’s test our setup and send the first message from our freshly created topic to our mailbox in the very same shape as the events from other SAP Cloud Platform services. For the demo purpose, we will use a simple manually published message. However, you could set up a publisher of choice among your AWS resources. Now let’s navigate to our topic and choose Publish message. We need to provide a message body and optionally, a subject and message attributes:

Once you’re ready with this step, click on Publish message. Within seconds (due to network latency it could take up to a couple of minutes) you will receive in your mailbox a message like this:

Further information on this scenario and exact property value mapping, you could find in the dedicated SAP Help Portal page.


This blog post is part of a series of blog posts related to integration between third-party monitoring tools and SAP Cloud Platform Alert Notification service. We will continuously add newly released integrations, so stay tuned!

We ask you – our customers and partners – to join us in our integration journey! Tell us what you use for monitoring solutions, what you need to integrate with them; tell us your experience, and what your alerting needs are!

Be the first to leave a comment
You must be Logged on to comment or reply to a post.