CLOUD / A CONCEPT NOTE

SQS

fully managed message queuing for decoupling services

~80 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

Amazon SQS is a message queue that lets you decouple application components. A producer sends a message; a consumer polls and processes it. If the consumer fails, the message becomes visible again after a visibility timeout. SQS scales to handle millions of messages per second and guarantees at-least-once delivery.

02 / FOLLOW THE MECHANISM

How a message flows through sqs

  1. Producer

    calls SendMessage with a JSON payload to a queue URL.

  2. SQS

    stores the message redundantly across multiple AZs and returns a message ID.

  3. Consumer

    polls ReceiveMessage — SQS returns up to 10 messages with a receipt handle and visibility timeout.

  4. Processing

    the consumer processes the message. If successful, it calls DeleteMessage with the receipt handle.

  5. Failure

    if the consumer doesn't delete within the visibility timeout, the message reappears for another consumer.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

send a message to SQS

aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue --message-body '{"key":"value"}'

EXAMPLE 02 · REFERENCE

poll for messages

aws sqs receive-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/my-queue

Explore command anatomy in the CLI lab