A web application uses a CloudFront distribution to serve images from an S3 bucket. Third-party tools sometimes upload corrupted images into the bucket. The company has Python logic that reliably detects corrupted images and wants to integrate that detection with minimal latency between ingestion and when the content is served. Which integration approach meets this requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Configure an S3 event notification to invoke an AWS Lambda function when images are uploaded..
Why this is the answer
The most effective approach is to configure an S3 event notification to invoke an AWS Lambda function when images are uploaded. This allows the Lambda function to immediately process and validate the newly uploaded image. If the image is corrupted, the Lambda function can take action, such as deleting it or moving it to a quarantine bucket, preventing it from ever being served by CloudFront. This ensures minimal latency between ingestion and content serving because the detection happens proactively, before a user requests the image. Lambda@Edge functions (viewer-response or origin-response) operate after an image has been requested and is in the process of being served. This introduces latency for the end-user if a corrupted image is detected at that stage, as the user would either receive an error or a delayed response while the function processes the image. While a Step Functions state machine could also be triggered by an S3 event, it adds unnecessary orchestration overhead for a simple, direct image validation task that a Lambda function can handle efficiently.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed