AWS Certified Developer – Associate (DVA-C02)Development with AWS ServicesMedium

A developer is designing an application where multiple microservices need to communicate asynchronously without direct coupling. Each microservice publishes messages about its state changes, and other microservices need to react to these specific messages. The solution must support fan-out to multiple subscribers and ensure message durability. Which AWS service combination is BEST suited for this scenario?

  1. AAmazon SQS for message queuing and Amazon SNS for fan-out.
  2. BAmazon SNS for message publication and fan-out, with SQS queues as subscribers.
  3. CAWS AppSync for real-time data synchronization.
  4. DAmazon Kinesis Data Streams for real-time data processing.
Show answer & explanation

Correct answer: B. Amazon SNS for message publication and fan-out, with SQS queues as subscribers.

Amazon SNS is ideal for fan-out messaging, allowing multiple subscribers to receive the same message. By subscribing SQS queues to an SNS topic, message durability and asynchronous processing are ensured, as SQS queues store messages until processed by consumers.

Why the other options are wrong

  • A. While SQS can queue messages, SNS is designed for fan-out. Using SQS alone for fan-out would require custom logic, and SNS for fan-out, while correct, is missing the durability aspect unless SQS is a subscriber.
  • C. AppSync is a GraphQL service for real-time data synchronization to client applications, not for inter-microservice asynchronous communication and fan-out in this context.
  • D. Kinesis Data Streams is for real-time streaming data at scale, not typically for general-purpose asynchronous microservice communication with fan-out and durability requirements in this manner.

SNS and SQS Integration

A common AWS pattern where Amazon SNS topics publish messages, and Amazon SQS queues subscribe to these topics to receive and durably store messages for processing by consumers.

  • SNS provides fan-out capabilities.
  • SQS provides message durability and decoupling for consumers.
  • Enables asynchronous, event-driven architectures.

Memory trick: The Speaker (SNS) broadcasts, and Queues (SQS) reliably catch the messages.

More Development with AWS Services questions