Concepts

AWS provides several managed services that help implement these patterns, which are essential knowledge areas for the AWS Certified Solutions Architect – Associate exam.

Queuing with Amazon SQS

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. It supports two types of message queues: standard queues, which offer maximum throughput, best-effort ordering, and at-least-once delivery; and FIFO queues, which are designed to guarantee that messages are processed exactly once, in the exact order that they are sent.

Standard Queues:

  • Throughput: Unlimited
  • Ordering: Best-effort (messages might be delivered in an order different from which they were sent)
  • Message Delivery: At least once (occasionally more than one copy of a message is delivered)

FIFO Queues:

  • Throughput: Up to 300 transactions per second (TPS) by default; up to 3,000 TPS with batching
  • Ordering: Strictly maintained (messages are delivered in the exact order they are sent)
  • Message Delivery: Exactly once (no duplicates)

Messaging with Amazon SNS

Amazon Simple Notification Service (SNS) is a fully managed pub/sub messaging service. It provides topics for high-throughput, push-based, many-to-many messaging. By using SNS, you can fan out messages to a large number of subscriber endpoints for parallel processing, including Amazon SQS queues, AWS Lambda functions, HTTP/S endpoints, and email addresses.

With pub/sub messaging, the publisher system can send messages to a topic, which is a logical access point and communication channel. Subscribers to that topic then automatically receive the messages. The flexibility of SNS makes it suitable for a wide variety of scenarios like system decoupling, fan-out messaging, and mobile push notifications.

Examples of SNS Topic Configuration:

  • Topic name: “notifications”
  • Protocol: Multiple protocols are supported like SQS, Lambda, email, SMS, HTTP/S, etc.
  • Visibility: Control who can Publish or Subscribe to the topic using IAM policies

Integrating SQS and SNS

SNS and SQS can be integrated to combine pub/sub and queuing models. This is particularly useful for broadcasting messages to multiple subscribers, where each subscriber might process the message in a different manner. For instance, when a new image is uploaded to an S3 bucket, this event can trigger an SNS topic. Different SQS queues, subscribed to this SNS topic, might handle image resizing, tagging or cataloging, each performing different actions upon receiving the same message.

Integration Pattern:

  1. A message is published to an SNS topic.
  2. Multiple SQS queues subscribed to the topic receive the message.
  3. Each SQS subscriber processes the message in a specific way, independent of other subscribers.

The pattern optimizes resource usage and improves system resiliency by ensuring that if one subscriber fails, it does not affect others.

Considerations for Architecting Queuing and Messaging Systems

  • Scalability: Both SQS and SNS scale seamlessly with demand, allowing architectures to handle high volumes of messages.
  • Durability: Messages are stored redundantly across multiple AZs, ensuring high availability and durability.
  • Availability: Using these services ensures that your messaging system is highly available and resilient to failure.

Conclusion

As an AWS Certified Solutions Architect – Associate, understanding the tools and services provided by AWS for queuing and messaging is crucial for designing scalable, resilient, and flexible systems. SQS and SNS are powerful AWS services facilitating these patterns with ease of management and integration, enabling robust architectures that can react and process information in real-time, as it happens. Whether you are building distributed applications, implementing event-driven architectures, or simply looking to decouple your system’s components, mastering these services is essential for passing the AWS Certified Solutions Architect – Associate exam and for succeeding in real-world AWS environments.

Answer the Questions in Comment Section

In a publish/subscribe model, messages are pushed directly to subscribers as soon as they are published.

  • (A) True
  • (B) False

Answer: A

Explanation: In the publish/subscribe model, messages are indeed pushed to subscribers automatically, without the subscribers having to request or poll for the data each time.

In AWS, Amazon Simple Queue Service (SQS) supports both standard and FIFO (First-In-First-Out) queues.

  • (A) True
  • (B) False

Answer: A

Explanation: Amazon SQS offers support for both standard queues, which offer maximum throughput, best-effort ordering, and at-least-once delivery, as well as FIFO queues, which are designed to ensure messages are processed exactly once and in the order that they are sent.

Which of the following AWS services is a managed pub/sub messaging service?

  • (A) Amazon Simple Notification Service (SNS)
  • (B) Amazon Kinesis
  • (C) Amazon Simple Email Service (SES)
  • (D) Amazon SQS

Answer: A

Explanation: Amazon SNS is a fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications.

AWS SNS can deliver messages to multiple types of endpoints, which of the following is not a supported endpoint for SNS?

  • (A) Amazon Simple Queue Service (SQS)
  • (B) AWS Lambda
  • (C) HTTPS
  • (D) Amazon DynamoDB

Answer: D

Explanation: Amazon SNS can deliver messages to a variety of recipients such as Amazon SQS queues, AWS Lambda functions, HTTP/HTTPS endpoints, email addresses, SMS, and mobile push notifications. However, it does not support direct message delivery to Amazon DynamoDB.

Dead-letter queues (DLQ) in AWS are used to hold messages that cannot be processed successfully. Which AWS service provides the DLQ feature?

  • (A) Amazon SNS
  • (B) Amazon SQS
  • (C) Both A and B
  • (D) Amazon Kinesis

Answer: C

Explanation: Both Amazon SNS and Amazon SQS offer the functionality of dead-letter queues, which are useful for debugging and isolating messages that cannot be processed successfully due to various reasons.

Which of the AWS services enables you to build serverless event-driven applications?

  • (A) Amazon EC2
  • (B) AWS Lambda
  • (C) Amazon S3
  • (D) AWS Elastic Beanstalk

Answer: B

Explanation: AWS Lambda is a compute service that lets you run code without provisioning or managing servers, making it ideal for building serverless event-driven applications.

Which attribute ensures exactly-once delivery in Amazon SQS?

  • (A) Visibility Timeout
  • (B) Message Deduplication ID
  • (C) Message Retention Period
  • (D) Delay Seconds

Answer: B

Explanation: In FIFO queues of Amazon SQS, the Message Deduplication ID is used to ensure exactly-once processing by deduplicating messages sent within a five-minute interval.

In AWS, which of the following is a managed real-time data streaming service?

  • (A) Amazon Kinesis Data Streams
  • (B) Amazon SNS
  • (C) Amazon SQS
  • (D) Amazon Athena

Answer: A

Explanation: Amazon Kinesis Data Streams is a scalable and durable real-time data streaming service that can continuously capture gigabytes of data per second from hundreds of thousands of sources.

Messages in an Amazon SQS queue are retained for a maximum of how many days?

  • (A) 1 day
  • (B) 7 days
  • (C) 14 days
  • (D) 30 days

Answer: C

Explanation: Amazon SQS allows you to configure a message retention period, with a maximum of 14 days.

True or False: In Amazon SNS, there is no direct way to filter messages being sent to topics.

  • (A) True
  • (B) False

Answer: B

Explanation: Amazon SNS supports message filtering, which allows subscribers to receive only a subset of messages based on the attributes of the message.

Long polling in Amazon SQS reduces the number of empty responses received when polling for messages, as well as the overall cost of using the service.

  • (A) True
  • (B) False

Answer: A

Explanation: Long polling is a feature in Amazon SQS that helps reduce costs and the number of empty responses (when there are no messages to receive) by allowing Amazon SQS to wait for a message to become available before sending an empty response.

Which AWS service is designed for application-to-person (A2P) communication?

  • (A) Amazon Pinpoint
  • (B) Amazon Connect
  • (C) Amazon SNS
  • (D) Amazon SQS

Answer: A

Explanation: Amazon Pinpoint is designed for A2P communication, enabling businesses to engage customers across multiple messaging channels such as SMS, email, and push notifications.

0 0 votes
Article Rating
Subscribe
Notify of
guest
23 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Kripa Nand
6 months ago

I found the explanation of the publish/subscribe model in this blog post very clear. It helped me understand how to implement it in AWS.

Vesna Hoksbergen
8 months ago

Thanks for the helpful information!

Liam Taylor
6 months ago

Can someone explain how exactly SNS differs from SQS in terms of use cases?

Anjo Petter
8 months ago

Appreciate the detailed points in the article!

April Brewer
7 months ago

What would be the best practice for handling message retries in SQS?

Malika Antonis
8 months ago

Great post! Helped me get through my exam prep.

Ian Bennett
6 months ago

For high-throughput scenarios, should we go with SQS FIFO or standard queues?

Mahé Noel
8 months ago

Very informative. Thanks!

23
0
Would love your thoughts, please comment.x
()
x