Which solution will meet these requirements?
Use a Lambda@Edge function that is invoked by a viewer-response event.
Use a Lambda@Edge function that is invoked by an origin-response event.
Use an S3 event notification that invokes an AWS Lambda function.
Use an S3 event notification that invokes an AWS Step Functions state machine.
Explanations:
A Lambda@Edge function invoked on a viewer-response event occurs after the content is cached and served to the user, causing delayed detection of corrupted images.
A Lambda@Edge function invoked on an origin-response event is triggered after CloudFront retrieves the object, resulting in higher latency for detection and correction.
An S3 event notification invoking an AWS Lambda function allows immediate processing when an object is uploaded to the S3 bucket, enabling fast detection and response.
Using an S3 event notification to invoke a Step Functions state machine would increase complexity and latency, making it less optimal for real-time detection.