Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

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

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

Exam AWS Certified Solutions Architect - Associate SAA-C03 topic 1 question 98 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 (?) , you can switch to a simple comment.
Switch to a voting comment New
Six_Fingered_Jose
Highly Voted 2 years ago
Selected Answer: C
answer should be C, users get duplicated messages because -> lambda polls the message, and starts processing the message. However, before the first lambda can finish processing the message, the visibility timeout runs out on SQS, and SQS returns the message to the poll, causing another Lambda node to process that same message. By increasing the visibility timeout, it should prevent SQS from returning a message back to the poll before Lambda can finish processing the message
upvoted 60 times
Ello2023
1 year, 10 months ago
I am confused. If the email has been sent many times already why would they need more time? I believe SQS Queue Fifo will keep in order and any duplicates with same ID will be deleted. Can you tell me where i am going wrong? Thanks
upvoted 8 times
Robrobtutu
1 year, 7 months ago
Increasing the visibility timeout would give time to the lambda function to finish processing the message, which would make it disappear from the queue, and therefore only one email would be send to the user. If the visibility timeout ends while the lambda function is still processing the message, the message will be returned to the queue and there another lambda function would pick it up and process it again, which would result in the user receiving two or more emails about the same thing.
upvoted 9 times
PaulEkwem
3 weeks, 1 day ago
Increasing the visibility timeout allows a message to remain hidden for a longer period after being received by a Lambda function. However, this only prevents other instances of the function from processing the same message during that time. If the function takes longer to process than expected, messages can still become visible again and be retried, potentially leading to duplicates.
upvoted 2 times
...
aadityaravi8
1 year, 4 months ago
I agree with your answer explanation
upvoted 1 times
...
...
MrAWS
1 year, 10 months ago
I tend to agree with you. See my comments above.
upvoted 2 times
...
...
MutiverseAgent
1 year, 4 months ago
I agree it seems solution is C, as thought the SQS FIFO makes sense deduplication id would make NO sense as the system who put messages in the queue is S3 events; and as far as I know S3 do not send duplicated events. Also, the question mention that users are complaining about receiving multiple emails for each email, which is different to say they are receiving occasionally a repeated email; so my guess is SQS FIFO is not needed.
upvoted 2 times
...
JoeGuan
1 year, 3 months ago
The FIFO SQS is for solving a different problem, where items in the queue require order. You cannot simply switch from a standard queue to fifo queue. Duplicate emails are a common issue with a standard queue. The documentation consistently reminds us that duplicate emails can occur, and the solution is not to create a FIFO queue, but rather adjust the configuration parameters accordingly.
upvoted 4 times
PLN6302
1 year, 3 months ago
amazon s3 doesn't support fifo queues
upvoted 3 times
...
...
...
brushek
Highly Voted 2 years, 1 month ago
Selected Answer: C
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html this is important part: Immediately after a message is received, it remains in the queue. To prevent other consumers from processing the message again, Amazon SQS sets a visibility timeout, a period of time during which Amazon SQS prevents other consumers from receiving and processing the message. The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours.
upvoted 15 times
...
PaulGa
Most Recent 2 months ago
Selected Answer: D
Ans D - is my preferred choice because it removes the record and therefore eliminates the possibility of duplication; the only snag here is ensuring the SQS record is locked. Ans C, which has the most votes will work but is less robust - but perhaps it is the cheapest option. Ans A, the author's preference, won't work unless the Lambda function is guaranteed to complete within 30secs - and nowhere is that stated
upvoted 2 times
...
jaradat02
4 months ago
the correct answer is C, although B and D might also work, C is the one that achieves the least operational overhead condition.
upvoted 1 times
...
Solomon2001
6 months, 2 weeks ago
Selected Answer: B
B. Change the SQS standard queue to an SQS FIFO queue. Use the message deduplication ID to discard duplicate messages. Here’s why this option is suitable: SQS FIFO Queue: Amazon SQS FIFO (First-In-First-Out) queues ensure that the order of messages is preserved. Each message in a FIFO queue has a unique message deduplication ID. By using a FIFO queue, you can prevent duplicate messages from being processed. Message Deduplication ID: When sending messages to a FIFO queue, set the message deduplication ID to ensure that identical messages are treated as duplicates. If a message with the same deduplication ID is sent within a 5-minute window, it is considered a duplicate and discarded. https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
upvoted 2 times
Anthony_Rodrigues
5 months, 3 weeks ago
This wouldn't work as expected because the issue is not the order or the queue receiving multiple times the same message. The issue is that the Lambda executes the same message multiple times. The FIFO deduplication ID works when the producer sends the message, not when the consumer is receiving the message. (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html) For this to work, the Lambda function would need to know/keep the last N deduplication ID to guarantee that it isn't processing the same message, which goes against Lambda's statelessness. Therefore, for this case, B is the best answer.
upvoted 1 times
...
...
824c449
6 months, 3 weeks ago
Selected Answer: B
B: Directly addresses the issue of duplicates by ensuring exact-once processing and message ordering, which mitigates the risk without requiring adjustments based on anticipated processing times or additional application logic to manage potential duplicates. So, while increasing the visibility timeout could help in managing when messages are available for processing again, it doesn't provide a structural solution to the problem of duplicate processing in the way that using an SQS FIFO queue does, nor does it ensure the operational simplicity and reliability that comes with eliminating duplicates at the source.
upvoted 2 times
...
ManikRoy
6 months, 3 weeks ago
Selected Answer: C
to all those who are considering option B, Its INCORRECT. Amazon Simple Queue Service FIFO (First-In-First-Out) queues aren't supported as an Amazon S3 event notification destination. https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html
upvoted 2 times
...
Uzbekistan
8 months ago
Selected Answer: B
Given the requirement to resolve the issue of multiple email messages being sent to users with the least operational overhead, the most appropriate solution is: B. Change the SQS standard queue to an SQS FIFO queue. Use the message deduplication ID to discard duplicate messages. Explanation: SQS FIFO Queue: FIFO (First-In-First-Out) queues in SQS ensure that the order in which messages are sent and received is strictly preserved and that each message is processed only once. By switching to an SQS FIFO queue, you can prevent the Lambda function from processing duplicate messages.
upvoted 1 times
ManikRoy
6 months, 3 weeks ago
Its INCORRECT Amazon Simple Queue Service FIFO (First-In-First-Out) queues aren't supported as an Amazon S3 event notification destination. https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html
upvoted 1 times
...
...
vip2
9 months, 1 week ago
Selected Answer: C
'Visibility Timeout' is suitable(better) solution to solve the issue.
upvoted 1 times
...
shwelin
9 months, 2 weeks ago
I will stick with "B", the correct answer.
upvoted 2 times
ManikRoy
6 months, 3 weeks ago
Its INCORRECT Amazon Simple Queue Service FIFO (First-In-First-Out) queues aren't supported as an Amazon S3 event notification destination. https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventNotifications.html
upvoted 1 times
...
...
0xE8D4A51000
10 months, 1 week ago
Selected Answer: B
All answers are wrong, the answer B
upvoted 2 times
...
awsgeek75
10 months, 1 week ago
Selected Answer: C
In this setup the only way to get multiple emails is when same image is processed multiple times. This only happens when another Lambda starts processing while the previous one hasn't finished processing. Increasing the SQS queue timeout to be greater than Lambda timeout will ensure that other Lambda can't see the SQS message before previous Lambda finishes processing or times out. So C is best answer A: Long polling won't fix anything B: FIFO is nice idea but how will the Lambda function know it has got a duplicate message? D: Wrong as in case of Lambda timeout that message is lost without being processed
upvoted 1 times
...
Ruffyit
1 year ago
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html this is important part: Immediately after a message is received, it remains in the queue. To prevent other consumers from processing the message again, Amazon SQS sets a visibility timeout, a period of time during which Amazon SQS prevents other consumers from receiving and processing the message. The default visibility timeout for a message is 30 seconds. The minimum is 0 seconds. The maximum is 12 hours
upvoted 3 times
...
lqw
1 year, 1 month ago
Selected Answer: C
least operational overheads
upvoted 1 times
...
prabhjot
1 year, 1 month ago
ans B - Option A (long polling), Option C (increasing visibility timeout), and Option D (deleting messages immediately) do not address the root cause of the problem, which is the duplication of messages in the queue.
upvoted 2 times
...
vijaykamal
1 year, 1 month ago
Long polling is incorrect...it just means that SQS queue is connected after specific interval instead of looking for messages in queue in very short interval...long polling saves money but does not help to remove duplicate. Correct Answer: C
upvoted 1 times
...
hieulam
1 year, 2 months ago
Selected Answer: A
I think A is correct. https://aws.amazon.com/blogs/developer/polling-messages-from-a-amazon-sqs-queue/#:~:text=When%20disabling,more%20API%20calls.
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 ...