Menu
Amazon Simple Queue Service
Developer Guide

Tutorial: Subscribing an Amazon SQS Queue to an Amazon SNS Topic

You can subscribe one or more Amazon SQS queues to an Amazon SNS topic from a list of topics available for the selected queue. Amazon SQS manages the subscription and any necessary permissions. When you publish a message to a topic, Amazon SNS sends the message to every subscribed queue. For more information about Amazon SNS, see What is Amazon Simple Notification Service? in the Amazon Simple Notification Service Developer Guide.

The following example demonstrates subscribing an existing Amazon SQS queue to an existing Amazon SNS topic.

Note

Amazon SNS isn't currently compatible with FIFO queues.

When you subscribe an Amazon SQS queue to an Amazon SNS topic, Amazon SNS uses HTTPS to forward messages to Amazon SQS.

AWS Management Console

  1. Sign in to the Amazon SQS console.

  2. From the list of queues, choose the queue (or queues) to which you want to subscribe an Amazon SNS topic.

  3. From Queue Actions, select Subscribe Queue to SNS Topic (or Subscribe Queues to SNS Topic).

    The Subscribe to a Topic dialog box is displayed.

  4. From the Choose a Topic drop-down list, select an Amazon SNS topic to which you want to subscribe your queue (or queues), select the Topic Region (optional), and then choose Subscribe.

    Note

    Typing a different Topic ARN is useful when you want to subscribe a queue to an Amazon SNS topic from an AWS account other than the one you used to create your Amazon SQS queue.

    This is also useful if the Amazon SNS topic isn't listed in the Choose a Topic drop-down list.

    The Topic Subscription Result dialog box is displayed.

  5. Review the list of Amazon SQS queues that are subscribed to the Amazon SNS topic and choose OK.

    The queue is subscribed to the topic.

    Note

    To list your subscriptions, unsubscribe from topics, and delete topics, use the Amazon SNS console. For more information, see Clean Up in the Amazon Simple Notification Service Developer Guide.

    To verify the results of the subscription, you can publish to the topic and then view the message that the topic sends to the queue. For more information, see Sending Amazon SNS Messages to Amazon SQS Queues in the Amazon Simple Notification Service Developer Guide.

On this page: