Question #795
A company’s video streaming platform uses Amazon CloudFront to deliver videos stored in an Amazon S3 bucket. Occasionally, high-resolution videos are uploaded without compression, leading to increased buffering for users. The company has successfully implemented Python-based compression logic. A solutions architect must integrate this logic to ensure compressed videos are served with minimal latency between ingestion and delivery. Which solution meets these requirements?
Use a Lambda@Edge function triggered by a viewer-response event to compress videos.
Use a Lambda@Edge function triggered by an origin-response event to compress videos.
Use an S3 event notification that invokes an AWS Lambda function to compress videos upon upload.
Use an S3 event notification that invokes an AWS Step Functions state machine to manage video compression workflows.
Explanation
Option C is correct because S3 event notifications can trigger a Lambda function as soon as a video is uploaded. This Lambda compresses the video and replaces or stores the compressed version in S3, ensuring subsequent CloudFront deliveries use the pre-compressed file. This minimizes latency because compression occurs upfront, not during user requests.
Options A and B involve Lambda@Edge, which compresses videos during user requests. This introduces latency due to on-the-fly processing and Lambda@Edge's execution time limits (e.g., 5 seconds for viewer events), making them unsuitable for large video compression. Option D uses Step Functions, which adds orchestration overhead when a simple Lambda invocation suffices. While Step Functions can manage workflows, the question emphasizes minimal latency, making Option C the most efficient choice.
Key Points:
1. S3 event notifications trigger immediate processing upon upload.
2. Lambda functions can handle longer compression tasks (up to 15 minutes).
3. Pre-compressed videos reduce CloudFront delivery latency.
4. Avoid on-the-fly compression (Lambda@Edge) for large files due to timeouts and inefficiency.
Answer
The correct answer is: C