Bosch IoT Device Management - will be discontinued by mid 2024

AWS SNS - HTTP connection

Publish twin events onto an AWS SNS topic.

In this example, we configure an HTTP connection that publishes twin events to AWS SNS (Simple Notification Service).

Table of contents:


To follow this example you will need:

  • A Bosch IoT Things service subscription

  • An AWS SNS topic

  • An AWS IAM user with access to SNS

Create the connection

Starting at the Bosch IoT Suite UI, click the Connection entry in the left navigation.

In case it is not there, use the search, and click the star icon to pin it to your navigation bar.


Please make sure, that your connections are active. This is indicated with the plug symbol: in the example below the first connection is open and will work, the second one is disabled.


If one of your connections are closed, just open them.

Click Add to create a new connection.

  • Select HTTP from the categories.

  • Give the connection a name. Setting a name is required.

  • Click the Continue button.


Configure credentials

  • Scroll to the Coordinates section.

  • Choose hmac as the credential type.

  • Choose aws4-hmac-sha256 as the algorithm.

  • Enter the AWS region of your SNS topic, e.g. eu-central-1.

  • Enter sns as the AWS service name.

  • Enter the access key of the SNS user.

  • Enter the secret key of the SNS user.


Configure the hostname

  • Scroll to the Connection coordinates section.

  • Enter the hostname of your SNS: sns.<aws-region>


Add a target

  • Scroll to the Targets section.

  • Click the Add target button.

  • Choose GET as the HTTP verb.

  • Enter / as the HTTP path.
    Payload mapping will compute the query parameters for SNS.

  • Add an authorization subject, e.g. integration:<solution-id>:sns.

  • Check Thing twin events under Topics to publish on address.

  • Click Save new target.


Configure payload mapping

  • Scroll to the Payload mapping section.

  • Check Enable custom JavaScript-based payload mapping.

  • Change the outgoing payload mapping to compute the query parameters of SNS, and set the query string via the special header http.query.
    Set the variable topicArn to the ARN of the SNS topic.

    function mapFromDittoProtocolMsg(namespace, name, group, channel, criterion,
    action, path, dittoHeaders, value, status, extra) {
    let topicArn = '<sns-topic-arn>';
    let textPayload = JSON.stringify(Ditto.buildDittoProtocolMsg(namespace, name,
    group, channel, criterion, action, path, dittoHeaders, value, status, extra));
    let query = 'Action=Publish&Message=' + encodeURIComponent(textPayload) +
    '&Subject=ThingModified&TopicArn=' + encodeURIComponent(topicArn);
    let headers = {"http.query": query};
    return Ditto.buildExternalMsg(headers,'',null,'text/plain');
  • Click the Create button at the top right to save the connection.

Authorize the connection for twin events

Follow the steps Add a policy entry for public cloud connections.

Replace xxx from that example with the authorization subject of this connection in the policy, e.g. integration:<solution-id>:sns.

Subsequent twin modifications will publish messages on the SNS topic and notify its subscribers.