Course menuDVA-C03

Exams / DVA-C03 / Study guide / Messaging with SQS, SNS and EventBridge

Messaging with SQS, SNS and EventBridge: DVA-C03 study notes and practice questions

What to know about Messaging with SQS, SNS and EventBridge for the DVA-C03 exam, from the Development with AWS Services domain (30% of the exam guide), then 2 free questions to test it. Part of the DVA-C03 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

Messaging is in Domain 1 under the skill of using asynchronous patterns and event-driven designs. The exam gives a delivery requirement, such as “every event must reach every team” or “messages must be processed in order,” and asks which service and setting meet it.

Choosing the service

  • SQS holds messages until one consumer processes and deletes them. Use it for work queues and to buffer bursts.
  • SNS pushes a copy of each message to every subscriber. Use it for fanout, usually to an SQS queue per consumer.
  • EventBridge routes events from many sources to targets by matching patterns. Use it for event-driven rules, scheduled events and cross-account routing.

Queue settings that decide answers

  • Standard queues give at-least-once delivery and best-effort ordering. FIFO queues keep order within a message group ID and remove duplicates within a 5-minute deduplication window.
  • Visibility timeout hides a received message from other consumers. Raise it above the longest processing time, or the message is redelivered while still in progress. The total time a message can stay hidden is capped at 12 hours.
  • Long polling (a wait time from 1 to 20 seconds) reduces empty responses and cost. Short polling is the default.
  • Dead-letter queue with a redrive policy: after maxReceiveCount failed receives, the message moves to the DLQ for inspection.
  • Delay queues and per-message delays hide new messages for a set time. Per-message delays are for standard queues only.
  • Retention is how long messages stay before removal. The default is four days, and the maximum is 14 days.
  • Large payloads go to Amazon S3 with the Amazon SQS Extended Client Library, which sends a pointer in the message.

Fanout and access

  • An SNS-to-SQS subscription needs a queue policy that lets the SNS service principal send messages. Restrict it with aws:SourceArn.
  • A queue encrypted with a customer managed KMS key also needs the SNS service to use that key.

EventBridge details

  • Event patterns match on fields with AND logic, so every condition must hold. Operators include numeric comparisons and anything-but.
  • An input transformer on a target changes the payload sent to that target. It does not change which events match.
  • Archives and replay keep events so you can resend them later. Dead-letter queues on targets hold events that failed delivery.

Common traps

  • Raising retention when the problem is the visibility timeout, or the reverse.
  • A shared standard queue when each team needs its own copy of every event. Use a topic with a queue per team.
  • A FIFO queue for a requirement that needs only a delay or a parallel workload. FIFO ordering reduces parallelism.
  • Expecting a DLQ to fix a slow consumer. A DLQ only catches messages that keep failing.

Try the 2 practice questions

A shipping team in one AWS account subscribes its Amazon SQS standard queue to an Amazon SNS topic owned by the orders team in a different account.

The subscription exists and the orders team's publishes succeed, but the shipping queue never receives a message. The queue's access policy currently allows only the shipping account's own roles.

The orders team cannot change its topic, and the shipping team must keep its queue as a standard queue.

Which change fixes the problem?

Choose one answer.

  1. A. Add an IAM policy to the orders team's publishing role that allows sqs:SendMessage on the shipping queue's ARN.
  2. B. Add a queue policy statement that allows sqs:SendMessage only when aws:SourceArn equals the topic's ARN.
  3. C. Convert the queue to a FIFO queue with content-based deduplication turned on, so that SNS can deliver to it.
  4. D. Attach a dead-letter queue to the subscription, so that failed deliveries are kept in a separate queue for inspection.
Show the answer and explanation

Answer: B

  • A. Wrong: SNS delivers to the queue itself, not with the publisher's credentials, so the publisher's role does not decide whether delivery is allowed. The queue would still refuse the messages.
  • B. Right: Correct. The queue's access policy decides whether SNS may deliver to it. A statement limited by aws:SourceArn to the topic's ARN lets only that topic send messages to the queue.
  • C. Wrong: FIFO changes how messages are ordered and deduplicated, not who may send to the queue. The queue policy would still deny SNS, so nothing would arrive.
  • D. Wrong: A dead-letter queue collects messages that SNS could not deliver, which helps diagnosis. It does not grant the delivery, so the queue policy still has to allow SNS.

Explanation

When an SQS queue in one account is subscribed to a topic in another, the queue's access policy must allow sqs:SendMessage from SNS. Limiting the statement with aws:SourceArn to the topic's ARN allows only that topic. Changing the publisher's IAM role, the queue type or the subscription's dead-letter queue does not add this permission.

Study

Question 2

Harder · choose 2 ·Link to this question (question 2)

A payments service sends account events to an Amazon SQS queue.

Events for the same account must be processed strictly in the order they were sent, but events for different accounts can be processed in parallel. The producer adds a sentAt timestamp to every send, so a retry after a network timeout has a different message body from the original. The retry must not create a second message.

Which TWO actions meet these requirements? (Choose two.)

Choose two answers.

  1. A. Use a FIFO queue and set the MessageGroupId of each message to the account ID.
  2. B. Use a FIFO queue and set the same MessageGroupId on every message.
  3. C. Enable content-based deduplication on the FIFO queue, so SQS hashes each message body to find duplicates.
  4. D. Use a FIFO queue and set each message's MessageDeduplicationId to an event ID that the producer creates once and reuses on every retry.
  5. E. Use a standard queue with long polling and a dead-letter queue for failed events.
Show the answer and explanation

Answers: A, D

  • A. Right: Correct. Messages in one message group are processed one at a time in strict order, while different groups can be worked on in parallel.
  • B. Wrong: Ordering would hold, but every message would share one group, so all events would be processed one at a time and accounts could not run in parallel.
  • C. Wrong: Content-based deduplication hashes the message body only. The sentAt timestamp makes every retry's body different, so the retry would not be recognized as a duplicate.
  • D. Right: Correct. SQS discards a repeat send with the same deduplication ID within the 5-minute deduplication interval. An ID that does not change on a retry works even when the body differs.
  • E. Wrong: Standard queues give best-effort ordering and do not remove duplicates, so neither requirement is met.

Explanation

In a FIFO queue, the message group ID is the unit of ordering: messages in one group are processed in strict order, and different groups can be processed in parallel. Duplicates are dropped by deduplication ID within the 5-minute interval. Content-based deduplication uses only the message body, so a timestamp added to each send defeats it; an explicit ID generated once per event does not.

Study

Want more on Messaging with SQS, SNS and EventBridge? The 5 full-length practice sets have 11 more Messaging with SQS, SNS and EventBridge questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Messaging with SQS, SNS and EventBridge

More Development with AWS Services topics