Amazon SQS, SNS and EventBridge
messaging
Find out where your message went¶
See which queues back up and which dead-letter queues hold failed messages, follow a message from a topic or an EventBridge rule hop by hop to the Lambda function that reads it, and find the policy or key that keeps a sender out, without clicking through three consoles.
- SQS, SNS and EventBridge in one map
- Read-only: never receives a message
- The fix as a command to copy
- A window to click through it
- Plain text outside Jupyter
The examples use acme's orders-events topic, which delivers to four queues and a Lambda function, and the shop event bus, whose order-placed rule sends big orders to an audit queue and a fraud check. Some of those deliveries fail, and 42 orders wait in a dead-letter queue.

msg.overview(): what failed first, then every queue, topic and rule, with the commands that fix what's wrong.
Watch it run¶
Three calls in a notebook, from every queue, topic and rule to one queue's dead letters: each call typed and run, and the report it draws, with what to notice. It plays as you scroll to it; click it to pause, or pick a chapter to jump to a call.
Full screen · Download as MP4, for Slack or a slide (light or dark, as this page is)
Set up in SageMaker¶
-
Install it in a notebook cell:
%pip install aws-analyzer -
Make the view. It uses the notebook's IAM role and region, so there's nothing to configure.
from aws_analyzer import MessagingView msg = MessagingView() msg.help() # every command, grouped by task; msg.help("follow") shows one in full
Another region or profile, plain text
Queues, topics and rules are regional, so if overview() comes back empty, check the region first. Only boto3 is required.
from aws_analyzer import MessagingAnalyzer, MessagingView
msg = MessagingView(MessagingAnalyzer(region="eu-west-1", profile="dev"))
msg = MessagingView(mode="text") # plain text, also what you get outside Jupyter
Start here¶
Five questions people bring to a queue or a topic, and the one line that answers each. None of them touch a message.
Health
- What's backing up or failing?
msg.overview() - What's wrong with this queue?
msg.queue_info("orders")
Where messages go
- Where does a message go from here?
msg.follow("orders-events") - Which messages failed for good?
msg.dead_letters()
Rather click?
- Can I click through it instead?
msg.explore()
A queue is named by its name, URL, ARN or console link; a topic by its name or ARN; a rule by its name, "bus/rule" ("shop/order-placed") or ARN.
How to read a report
Every report puts the answer first: cards with the numbers that matter, then the findings, warnings first, each a bold headline with why it matters and what to do underneath. The tables of detail come after, and Next at the bottom lists two or three commands with the arguments filled in. One click on a command selects all of it, ready to copy.
Everything at once¶
overview() lists every queue, topic and EventBridge rule in the region with what waits, what failed and what it costs over the last 7 days, the things that need attention first.
msg.overview() # or overview(days=30)
The queues table puts dead-letter queues holding messages first, then the fullest queues. Oldest is the age of the oldest message waiting, marked when it's past half the queue's retention, because a message is deleted unread when it reaches it. The topics and rules tables put the ones with failed deliveries first, and a rule's pattern reads as a sentence: "OrderPlaced events from shop.orders where detail.total > 100".
When a queue's or function's policy keeps a topic or rule out, Let them in shows the command that lets it in: for a queue, its whole policy with a statement added for each sender (SetQueueAttributes replaces the policy, so the command keeps what's there).
Worth knowing
SNS and EventBridge can't use the AWS managed key alias/aws/sqs. A queue encrypted with it silently drops everything they send it, whatever its policy says. The findings say so; switch the queue to SQS-managed encryption or a key of your own.
Follow a message¶
follow() draws the way a message takes from a topic, queue, rule or bus: what sends to it, then every subscription, target, queue, reader and dead-letter queue downstream, each with its numbers and what's wrong there.
msg.follow("orders-events") # a topic
msg.follow("orders") # a queue: what sends to it, who reads it, where failures go
msg.follow("shop/order-placed") # a rule, or "shop" for the whole bus

msg.follow("orders-events"): two of the five places it delivers to keep it out.
How it gets there says what carries a message to each hop: a subscription and its filter in plain English, a rule's target and its retries, a Lambda function reading a queue, or a queue's dead-letter queue after so many failed receives. Problem marks where messages get lost: a policy or key that keeps the sender out, a subscription nobody confirmed, a disabled rule or trigger, a function that no longer exists, a dead-letter queue holding messages.
Dead-letter queues¶
dead_letters() lists every dead-letter queue, the fullest first: how many failed messages each holds, how old the oldest is, what it catches failures from, and the command that moves them back.
msg.dead_letters()
A dead-letter queue catches what a queue couldn't process after so many receives, what an SNS subscription couldn't deliver, or what an EventBridge target couldn't take. For a queue's failures, aws sqs start-message-move-task --source-arn <dlq-arn> moves the messages back to the queue they came from; run it once the cause is fixed, or they fail again.
Worth knowing
A message's age counts from when it was first sent, not from when it reached the dead-letter queue. A dead-letter queue that keeps messages no longer than its source can delete a failure before anyone looks. The findings say when, with the command that keeps them 14 days.
Why it never shows what's in a queue
The only way to read a message is ReceiveMessage, and receiving changes the message: it's hidden from its real readers for the visibility timeout, and the receive counts as a try towards its dead-letter queue. On a FIFO queue it also holds up every message behind it in its group. So even a look can push a message into the dead-letter queue, and this module never does it. It shows counts, ages and settings, from GetQueueAttributes and CloudWatch. Why a message failed is in its reader's logs: for a Lambda function, LambdaView().errors("orders-etl").
One queue, topic or rule¶
queue_info(), topic_info() and rule_info() show one of them in full, with its settings in plain English, a line per day and what to fix.
msg.queue_info("orders")
msg.topic_info("orders-events")
msg.rule_info("shop/order-placed")

msg.queue_info("orders"): its dead-letter queue holds 42 failures, and its visibility timeout is short for its reader.
A queue's report explains each setting (the visibility timeout, retention, receive wait, its dead-letter queue), lists the topics and rules that send to it and whether its policy lets them, and the Lambda functions that read it. It warns when the visibility timeout is shorter than six times the function's timeout (AWS's advice: otherwise a message comes back while it's still being worked on), when messages wait and nothing reads them, when the queue falls behind, and when empty receives cost money that long polling would save.
A topic's report lists its subscriptions with their filters, whether each is confirmed, its dead-letter queue and whether the queue or function lets the topic in. A rule's report says which events it matches, and its targets with their retries and dead-letter queues; a rule that matched nothing gets the aws events test-event-pattern command to check an event against it.
Explore by clicking¶
explore() opens a window with every queue, topic and rule, the failed messages first; click one to see it in full, follow its messages on a map, or watch a queue drain.
msg.explore() # a dead-letter queue holding messages first, else the most problems
msg.explore("orders-events", tab="map") # straight to where a topic's messages go
The messaging explorer guide covers every tab, with its own video tour.
That's the guide. Everything below is reference for when you need it: the data in Python, cost, permissions, troubleshooting and every command.
Use the data in Python¶
msg.core is the MessagingAnalyzer. Every report has a data method on it.
core = msg.core
ov = core.overview(days=7) # Overview: .queues, .topics, .buses, .rules, .queue_numbers, .errors
ov.queues_df() # every queue and its numbers as a DataFrame
report = core.queue_report("orders") # QueueReport: .queue, .numbers, .dlq, .feeders
core.topic_report("orders-events") # TopicReport: .topic (.subscriptions), .numbers, .queues, .functions
core.rule_report("shop/order-placed") # RuleReport: .rule (.targets, .pattern), .numbers
core.dead_letters() # DeadLetter: .queue, .numbers, .catches
core.follow("orders-events").hops # Hop: .kind, .name, .via, .numbers, .problem
The analysis functions make no AWS calls, so they work on what you already have:
from aws_analyzer.messaging import allows, describe_pattern
describe_pattern({"source": ["shop.orders"], "detail-type": ["OrderPlaced"]}) # 'OrderPlaced events from shop.orders'
allows(queue_policy, service="sns.amazonaws.com", action="sqs:SendMessage", source_arn=topic_arn)
Cost¶
Costs are estimates at us-east-1 list prices (MESSAGING_PRICES, the first tier after the free tier): SQS $0.40 per million requests ($0.50 FIFO), SNS $0.50 per million messages published plus $0.60 per million HTTPS and $20 per million email deliveries (deliveries to SQS and Lambda are free). A queue's requests are every message sent, received and deleted plus every empty receive, which is the most it can be: batches of up to 10 make it fewer. Pass your own prices with MessagingAnalyzer(prices={"sqs_request": 0.00000045}).
overview() reads 6 CloudWatch metrics per queue and per rule and 6 per topic ($0.01 per 1,000) and says how many; reading queues, topics and rules costs nothing.
Permissions¶
Everything is read-only. Anything the notebook's role can't read shows up as a note instead of an error. This policy covers every command:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadQueuesTopicsRules",
"Effect": "Allow",
"Action": [
"sqs:ListQueues", "sqs:GetQueueAttributes", "sqs:GetQueueUrl", "sqs:ListDeadLetterSourceQueues",
"sns:ListTopics", "sns:GetTopicAttributes", "sns:ListSubscriptions", "sns:ListSubscriptionsByTopic",
"sns:GetSubscriptionAttributes",
"events:ListEventBuses", "events:ListRules", "events:DescribeRule", "events:ListTargetsByRule",
"events:ListRuleNamesByTarget", "events:ListArchives"
],
"Resource": "*"
},
{
"Sid": "ReadNumbersAndReaders",
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricData", "lambda:ListEventSourceMappings", "lambda:GetFunctionConfiguration",
"lambda:GetPolicy"
],
"Resource": "*"
}
]
}
There's no sqs:ReceiveMessage: nothing here reads, sends, moves or deletes a message.
Troubleshooting¶
“No queue named …”
Names are case-sensitive and queues are regional. The note lists the closest names; overview() lists them all. Use MessagingView(MessagingAnalyzer(region="eu-west-1")) for another region.
A topic's deliveries fail but every subscriber says “yes”
The policy check only reads queues and functions in this account and region, and a condition it can't judge (an account, an organization) counts as met. Turn on delivery status logging (the finding shows the command) and CloudWatch Logs says why each delivery failed.
The numbers are all “?”
CloudWatch couldn't be read: the note says why. cloudwatch:GetMetricData is what's needed.
Command reference¶
Every MessagingView command. msg.help() prints the same list grouped by task, and msg.help("follow") shows one command's full description.
| Command | What it shows |
|---|---|
overview(days=7) |
Every queue, topic and rule: what waits, dead letters, failed deliveries, cost, and what needs attention |
follow(name, days=7) |
Where a message goes from a topic, queue, rule or bus, hop by hop, and where it gets lost |
dead_letters(days=7) |
Every dead-letter queue: its failed messages, what it catches them from, and the command that moves them back |
queue_info(name, days=7) |
One queue: backlog, settings in plain English, readers, senders and its dead-letter queue |
topic_info(name, days=7) |
One topic: subscriptions, filters, failed deliveries, and which subscribers keep it out |
rule_info(name, bus=None, days=7) |
One EventBridge rule: what it matches, its targets, failed deliveries |
explore(where=None, tab=None, days=7, height=None) |
The explorer window: everything, one in full, its map, the dead-letter queues and Live |
help(command=None) |
This list, grouped by task; help("name") shows one command in full |