Soru

Zorluk: KolayMessage-Based Integration using Amazon SQS and SNS

A developer is designing a messaging architecture for a smart thermostat application. The application publishes temperature alert messages to an Amazon SNS topic. The developer needs to process these alerts using an AWS Lambda function. The solution must ensure that no alerts are lost if the Lambda function experiences a sudden surge in invocations and is throttled.

Which two configuration steps should the developer perform to meet these requirements?

  1. Create an Amazon SQS queue and subscribe the queue to the Amazon SNS topic.Cevap
  2. Configure the AWS Lambda function to consume messages from the Amazon SQS queue.Cevap
  3. C
    Configure the SQS queue's visibility timeout to be shorter than the Lambda function's timeout to accelerate message processing.
  4. D
    Set the AWS Lambda function's execution timeout to be greater than the SQS queue's visibility timeout to prevent Lambda timeout errors.
  5. E
    Initialize the Amazon SQS client inside the Lambda function using hardcoded IAM user access keys.

Cevap

Create an Amazon SQS queue and subscribe the queue to the Amazon SNS topic, and configure the AWS Lambda function to consume messages from the Amazon SQS queue.
To handle sudden spikes and prevent message loss when Lambda is throttled, the developer should create an Amazon SQS queue and subscribe it to the Amazon SNS topic. Then, the Lambda function should be configured to consume from the SQS queue. This architecture buffers incoming traffic in the queue, allowing Lambda to process them reliably as execution capacity allows.

Adım Adım Çözüm

1
Evaluate how to handle message bursts and avoid data loss from consumer throttling.
Determine that placing an Amazon SQS queue between the Amazon SNS topic and the AWS Lambda function allows messages to be safely buffered.
SNS attempts to push messages directly; if Lambda is throttled, messages can be lost. SQS provides durable message buffering.
2
Establish the polling integration between SQS and Lambda.
Configure the Lambda function with an SQS event source mapping.
This sets up the pull-based consumption pattern where Lambda processes messages at a controlled rate without being overwhelmed by SNS spikes.

Anahtar Kavram

Decoupling and buffering message processing using the SNS-to-SQS fanout pattern to handle downstream consumer throttling.
Tahmini Süre:1m 0s
Bu soruyu puanla