DocumentationFundamentals

AWS SNS

Subscribe to Amazon SNS topics and publish webhook data to SNS using Webhook Relay service connections.

Connect Webhook Relay to Amazon SNS to subscribe to topics (input) or publish webhook data to topics (output).

Prerequisites

IAM Permissions

For SNS Input (subscribe to topics):

  • sns:Subscribe
  • sns:GetTopicAttributes
  • sqs:CreateQueue
  • sqs:SetQueueAttributes
  • sqs:ReceiveMessage
  • sqs:DeleteMessage
  • sqs:GetQueueUrl

SNS inputs require SQS permissions because Webhook Relay creates a dedicated SQS queue (whr-sns-{input_id}) and subscribes it to your SNS topic. Messages are then polled from this queue.

For SNS Output (publish to topics):

  • sns:Publish
  • sns:GetTopicAttributes

SNS Input — Subscribe to a Topic

Service Connection Input

SNS inputs subscribe to your SNS topic and relay every published message into your Webhook Relay bucket. Internally, a dedicated SQS queue is created and subscribed to the topic, then polled for messages.

Configuration

FieldRequiredDescription
topic_arnYesSNS Topic ARN (e.g. arn:aws:sns:us-east-1:123456789:my-topic)
regionNoAWS region — auto-extracted from the ARN
subscription_arnAutoPopulated after the subscription is created

ARN format: arn:aws[-cn|-us-gov]:sns:<region>:<account-id>:<topic-name>

SNS Output — Publish Webhooks to a Topic

SNS outputs publish incoming webhook data as messages to your SNS topic. This lets you fan out webhooks to all SNS subscribers (Lambda, SQS, email, HTTP endpoints, etc.).

Configuration

FieldRequiredDescription
topic_arnYesSNS Topic ARN
regionNoAWS region — auto-extracted from the ARN

Example: Bridge GCP Cloud Storage to AWS SNS

Notify all your SNS subscribers when a new object is created in a GCS bucket — useful for triggering Lambda functions, sending notifications, or fanning out to multiple SQS queues:

  1. Create a GCP service connection with GCS viewer permissions
  2. Create an AWS service connection with SNS publish permissions
  3. Create a bucket in Webhook Relay
  4. Add a GCP GCS input on the bucket (object notifications flow in)
  5. Add an AWS SNS output on the bucket (notifications published to the topic)

Transform the Notification

Use a Function to reshape the GCS notification into a format your SNS subscribers expect:

const gcsEvent = JSON.parse(r.body)

// Create a message your SNS subscribers can process
const notification = {
    event: "object.created",
    source: "gcs",
    bucket: gcsEvent.bucket,
    object: gcsEvent.name,
    size: gcsEvent.size,
    content_type: gcsEvent.contentType,
    timestamp: new Date().toISOString()
}

r.setBody(JSON.stringify(notification))

See the JSON encoding and HTTP requests guides for more function examples.

Example: SNS to External HTTPS Webhook

While SNS natively supports HTTP/HTTPS subscriptions, Webhook Relay adds capabilities on top:

  • Payload transformation — reshape the SNS message before delivery using Functions
  • Authentication — add custom auth headers to outgoing requests
  • Retry and logging — full delivery logs with automatic retries
  • Multi-destination — forward to multiple HTTPS endpoints, SQS queues, S3, or GCP services simultaneously
  1. Create an AWS service connection
  2. Create a bucket with an SNS input pointing to your topic
  3. Add one or more public destinations

Example: AWS SNS to GCP Pub/Sub

Route SNS messages to a GCP Pub/Sub topic for cross-cloud event distribution:

  1. Create an AWS service connection with SNS subscribe permissions
  2. Create a GCP service connection with Pub/Sub publisher permissions
  3. Create a bucket with an SNS input and a GCP Pub/Sub output

Every message published to your SNS topic is automatically forwarded to the Pub/Sub topic, bridging AWS and GCP event systems.

Did this page help you?