Arkinu
AWS service comparison

Amazon MQ vs Amazon SQS: differences and when to use each

Amazon MQ
Amazon SQS

Often confused on the examQuestions tend to offer one as a distractor for the other: look for the phrase in the scenario that tips the balance.

Application Integration

Amazon MQ

Managed message broker for Apache ActiveMQ Classic and RabbitMQ that handles their installation, operation, and maintenance. It lets you migrate applications that already use standard messaging protocols and APIs (JMS, AMQP, MQTT, STOMP) without rewriting their messaging code.

Exam phrases that point here

  • «migrate applications that already use a message broker to the cloud without rewriting the messaging code»

    Amazon MQ is a managed broker for Apache ActiveMQ and RabbitMQ that speaks the same standard APIs and protocols; usually all it takes is pointing the applications at the new broker's endpoint.

    When not: If the application is new or can be rewritten, AWS recommends considering Amazon SQS and Amazon SNS: they are lighter-weight, fully managed, and scale almost without limit.

  • «applications communicate using standard protocols such as JMS, AMQP, MQTT, or STOMP»

    Amazon MQ supports APIs such as JMS and NMS and protocols such as AMQP, STOMP, MQTT, and WebSocket, so existing clients keep working.

    When not: If the scenario only asks for a queue or notifications and does not mention a dependency on a standard protocol or API, the expected answer is usually Amazon SQS or Amazon SNS.

  • «stop managing the broker on Amazon EC2 (patching, upgrades, and failure recovery)»

    Amazon MQ provisions the broker's infrastructure and software and handles upgrades, security patches, failure detection, and recovery.

    When not: If custom plugins or deep customization of the broker are needed, the FAQ indicates that it is better to keep managing it on EC2.

  • «highly available message broker across Availability Zones»

    For ActiveMQ there is the active/standby deployment (two brokers in two AZs with shared storage on Amazon EFS); for RabbitMQ, a three-node cluster.

    When not: A single-instance broker is one broker in one AZ, without the redundancy of those deployments. If compatibility with a broker is not needed, SQS is a fully managed service that is usually simpler.

Study Amazon MQ →

Application Integration

Amazon SQS

Managed message queue that stores messages until a consumer processes and deletes them, or until their retention period expires (14 days maximum). It is used to decouple the components of a distributed system and to absorb load spikes as a request buffer.

Exam phrases that point here

  • «decouple the application components»

    A queue sits between whoever produces the work and whoever processes it: the producer leaves the message and moves on, and the consumer picks it up when it can. If either one fails or slows down, the other does not notice.

    When not: If the same message must reach several targets at once, the pattern is publish/subscribe (Amazon SNS), and if you need to route events based on their content or react to events from AWS or third-party services, Amazon EventBridge is usually a better fit.

  • «absorb traffic spikes without losing requests»

    The queue stores the messages while the consumers cannot keep up, so the spike turns into a processing delay instead of lost requests.

    When not: It only works if the work can be done asynchronously. If the user needs the response right away, the solution is to scale the tier that responds (for example, with a load balancer and Auto Scaling), not to queue.

  • «process messages in the exact order they were sent and without duplicates»

    Amazon SQS FIFO queues preserve ordering within each message group and prevent processing the same message twice.

    When not: A standard queue guarantees neither ordering nor the absence of duplicates. And if several consumers must read the same data stream or reprocess it in real time, think of Amazon Kinesis Data Streams, not a queue.

  • «isolate messages that could not be processed so they can be analyzed later»

    A dead-letter queue receives the messages that consumers failed to process after several attempts, so they do not block the queue and can be reviewed.

    When not: If the scenario asks to retry or capture failures of an asynchronously invoked AWS Lambda function, or of an AWS Step Functions workflow, the answer may lie in that service's configuration and not in an SQS queue.

  • «each task must be processed by a single worker»

    In a queue, a received message is hidden from the other consumers for the duration of the visibility timeout; the worker that processes it deletes it when done.

    When not: If several systems must be notified of the task at once, each with its own copy, the clue points to Amazon SNS (often combined with several SQS queues).

Often paired with

  • AWS Lambda
  • Amazon SNS
Study Amazon SQS →