exam questions

Exam AWS Certified Solutions Architect - Associate SAA-C02 All Questions

View all questions & answers for the AWS Certified Solutions Architect - Associate SAA-C02 exam

Exam AWS Certified Solutions Architect - Associate SAA-C02 topic 1 question 722 discussion

An image-processing company has a web application that users use to upload images. The application uploads the images into an Amazon S3 bucket. The company has set up S3 event notifications to publish the object creation events to an Amazon Simple Queue Service (Amazon SQS) standard queue. The SQS queue serves as the event source for an AWS Lambda function that processes the images and sends the results to users through email.
Users report that they are receiving multiple email messages for every uploaded image. A solutions architect determines that SQS messages are invoking the
Lambda function more than once, resulting in multiple email messages.
What should the solutions architect do to resolve this issue with the LEAST operational overhead?

  • A. Set up long polling in the SQS queue by increasing the ReceiveMessage wait time to 30 seconds.
  • B. Change the SQS standard queue to an SQS FIFO queue. Use the message deduplication ID to discard duplicate messages.
  • C. Increase the visibility timeout in the SQS queue to a value that is greater than the total of the function timeout and the batch window timeout.
  • D. Modify the Lambda function to delete each message from the SQS queue immediately after the message is read before processing.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Mican07
1 year, 3 months ago
Answer is B
upvoted 1 times
...
1rob
1 year, 5 months ago
Selected Answer: D
Read this remark in the question carefully: A solutions architect determines that SQS messages are invoking the Lambda function more than once, resulting in multiple email messages. So this is NOT about duplicate SQS messages. The Lambda function is invoked more than once. From the documentation , it gives: "Lambda polls the queue and invokes your Lambda function synchronously with an event that contains queue messages. Lambda reads messages in batches and invokes your function once for each batch. When your function successfully processes a batch, Lambda deletes its messages from the queue." ( From <https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html ) So Lambda is handling the messages in a batch.So this happens: lambda -> fetch queue messages in a batch --> invoke lambda function once for each batch. --> If batch is successfully processed, then delete the messages from the queue.
upvoted 1 times
1rob
1 year, 5 months ago
Now, the same documentation states:"When Lambda reads a batch, the messages stay in the queue but are hidden for the length of the queue's visibility timeout. If your function successfully processes the batch, Lambda deletes the messages from the queue. By default, if your function encounters an error while processing a batch, all messages in that batch become visible in the queue again. For this reason, your function code must be able to process the same message multiple times without unintended side effects." So the proces sequence now looks like: lambda -> fetch queue messages in a batch --> invoke lambda function once for each batch. --> If batch is successfully processed, then delete the messages from the queue. If not: all messages in that batch become visible in the queue again.
upvoted 1 times
1rob
1 year, 5 months ago
For this failures, the documentation says: "To prevent Lambda from processing a message multiple times, you can either configure your event source mapping to include batch item failures in your function response, or you can use the Amazon SQS API action DeleteMessage to remove messages from the queue as your Lambda function successfully processes them. For more information on using the Amazon SQS API, see the Amazon Simple Queue Service API Reference "
upvoted 1 times
1rob
1 year, 5 months ago
For this failures, the documentation says: "To prevent Lambda from processing a message multiple times, you can either configure your event source mapping to include batch item failures in your function response, or you can use the Amazon SQS API action DeleteMessage to remove messages from the queue as your Lambda function successfully processes them. For more information on using the Amazon SQS API, see the Amazon Simple Queue Service API Reference "
upvoted 1 times
1rob
1 year, 5 months ago
Sorry for the duplicated comment, going further: When you look into "batch item failures" documentation, it gives: ( From <https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting> ) Implementing partial batch responses When your Lambda function encounters an error while processing a batch, all messages in that batch become visible in the queue again by default, including messages that Lambda processed successfully. As a result, your function can end up processing the same message several times.
upvoted 1 times
1rob
1 year, 5 months ago
To avoid reprocessing successfully processed messages in a failed batch, you can configure your event source mapping to make only the failed messages visible again. This is called a partial batch response. To turn on partial batch responses, specify ReportBatchItemFailures for the FunctionResponseTypes action when configuring your event source mapping. This lets your function return a partial success, which can help reduce the number of unnecessary retries on records. (…)
upvoted 1 times
...
...
...
...
...
...
BATSIE
1 year, 7 months ago
Selected Answer: B
Amazon SQS FIFO queues provide exactly-once processing, which means that each message is delivered once and remains available until a consumer processes and deletes it. Duplicates are not introduced into the queue. FIFO queues also support message groups that allow multiple ordered message groups within a single FIFO queue.
upvoted 1 times
...
BECAUSE
1 year, 10 months ago
Selected Answer: C
C is the answer
upvoted 1 times
BATSIE
1 year, 7 months ago
Increasing the visibility timeout can help to prevent other consumers from processing the message, but it doesn’t guarantee that a message will not be delivered more than once.
upvoted 1 times
...
...
sivasumanth
2 years, 6 months ago
Selected Answer: C
C Increase the msg visibility timeout to 15 mins so that it won't be read again.
upvoted 1 times
MrAWS
2 years, 3 months ago
this makes no sense, it doesn't matter if that particular message isn't read again.. the issue is they are using a standard queue which has duplication issues.
upvoted 1 times
...
...
sundubu
2 years, 7 months ago
Selected Answer: C
I think C
upvoted 2 times
...
Alexander_Nox
2 years, 7 months ago
Selected Answer: A
A is matching in this case
upvoted 1 times
Alexander_Nox
2 years, 6 months ago
Nah, I'm sorry, answer is C due Long polling can be max 20sec...
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago