Amazon SNS

The Amazon Simple Notification Service (SNS) is a fast, flexible, fully managed pub-sub messaging service. Use it as a cloud-based mobile app notification service to send push notifications, email, and SMS messages; or as an enterprise-messaging infrastructure.

Amazon SNS provides support for Push Notification of messages as well as distribution of messages to custom HTTP endpoints or via conventional SMS, email and other messaging channels.

Cloud CMS API

Cloud CMS connects to Amazon SNS to deliver messages that inform your custom notification handlers of events that occur within the API. These events include content lifecycle events (such as when content is created, updated or deleted) and also invalidation events that you can use to refresh application server caches that intend to reflect the current state of content in a branch.

Once messages are placed onto Amazon SNS, they can be routed via Push Notifications to your iOS and Android applications via Amazon's Apple and Android connectors. In this way, your mobile applications are empowered to respond in real-time as content is approved and scheduled within Cloud CMS.

Amazon SNS can also be connected to Amazon SQS (Simple Queue Service) to support message queues. Amazon SQS provides a solid backend for your application server tier to invalidate performance and object caches used to serve your own custom APIs and web applications.

Pre-requisites

To use your own SNS notification endpoints, you will need to create your own account within Amazon AWS as well as set up and manage things on your own. General assistance can be found on the Amazon Web Services web site.

Create an Amazon SNS Topic

Create a Topic with any name you'd like. When you create this Topic, you will need to remember which region it was created in. The region will look something like this:

us-east-1

Once created, the Topic will have an ARN identifier. It will look something like this:

arn:aws:sqs:us-east-1:123456789012:my-message-queue

You'll need the '''region''' and '''topic_arn''' in the next steps.

Create an IAM User

Although not strictly required, it is highly advised that you create a separate IAM User. IAM is Amazon Identity Access Management layer. By creating a separate user, you avoid sharing your private root user privileges. Make sure that your IAM user has full or sufficient access to Amazon SNS and the topic.

When you create your user, you will need to copy down the '''accessKey''' and '''secretKey'''.

Create a Service Descriptor

In Cloud CMS, you can now create a service descriptor. Log in as a manager and go to Platform > Platform Settings > Services. Click on Add Service Descriptor and fill out the form with the following:

Title - (any title you like, hopefully something meaningful)
Descriptor Key - (any unique key, such as "myapp_sns")
Descriptor Type - "Amazon SNS"
Descriptor Family - "Deployment Notifications"

Under Descriptor Configuration, fill in a JSON object like this:

{
   "enabled": true,
   "topic": "<topic_arn>",
   "providerType": "sns",
   "providerConfig": {
      "accessKey": "<accessKey>",
      "secretKey": "<secretKey>",
      "region": "<region>"
    }
}

Click the "Create" button to create your service descriptor.

Configure your Application Deployment

Within Cloud CMS, you create Applications to define entry points for external applications to work with your content. Every set of API Keys that you generate is tied to an Application instance.

Each Application supports 1 or more deployments. To get your deployment to interact with the notification endpoint, we'll need to configure in one additional property.

  1. Find your Application instance by going into your project and take note of it's ID (_doc).

  2. Go to the Cloud CMS Administration Console (/admin) and find your Application in the Data Stores section.

  3. From the list of Applications click the relevant Application object and then the Edit JSON button.

  4. Locate the deployments.default JSON object and add the following property:

    "notificationServiceConfigKey": " "

Use the "key" value of the service descriptor you created in the previous step. For example, you might put:

"notificationServiceConfigKey": "myapp_sns"

Save your changes and you're done. Content invalidation events will begin publishing to your notification endpoint right away.