SNS (Simple Notification Service)

This document contains information about the SNS service supported in Handel. This Handel service provisions an SNS topic for use by your applications.

Service Limitations

Important

This service only offers limited tagging support. SNS Topics will not be tagged, but the Cloudformation stack used to create them will be. See Tagging Unsupported Resources.

Parameters

Parameter Type Required Default Description
type string Yes   This must always be sns for this service type.
subscriptions Subscriptions No   An optional list of statically-defined subscriptions. You can also dynamically add subscriptions in your application code.
tags Resource Tags No   Tags to be applied to the Cloudformation stack which provisions this resource.

Subscriptions

The Subscription element is defined by the following schema:

subscriptions:
  - endpoint: <string>
    protocol: <http|https|email|email-json|sms>

See the SNS subscription documentation for full details on configuring endpoints and protocols.

Note

Protocols sqs, application, and lambda are supported through Service Events.

Example Handel File

This Handel file shows an SNS service being configured:

version: 1

name: my-sns-topic

environments:
  dev:
    topic:
      type: sns
      subscriptions:
        - endpoint: fake@example.com
          protocol: email

Example Handel File

This Handel file shows an SNS Topic as a dependency to a Lambda Function

version: 1

name: my-lambda-sns-example
environments:
  dev:
    function:
      type: lambda
      path_to_code: .
      handler: lambda_function.lambda_handler
      runtime: python3.6
      timeout: 180
      dependencies:
      - topic
    topic:
      type: sns
      subscriptions:
        - endpoint: fake@example.com
          protocol: email

Depending on this service

This service outputs the following environment variables:

Environment Variable Description
<SERVICE_NAME>_TOPIC_ARN The AWS ARN of the created topic
<SERVICE_NAME>_TOPIC_NAME The name of the created topic

See Environment Variable Names for information about how the service name is included in the environment variable name.

Events produced by this service

The SNS service currently produces events for the following services types:

  • Lambda
  • SQS

Events consumed by this service

The SNS service currently consumes events for the following service types:

  • CloudWatch Events
  • S3