DVA-C02 Question 124
Select 3You are developing a serverless application using AWS Lambda to process images uploaded to an S3 bucket. The function must resize the images and store the resized versions back into another S3 bucket. The resized images need to be publicly accessible. Which steps should you take to ensure your application functions correctly?
- A
Configure an S3 event notification on the source bucket to trigger the Lambda function when an image is uploaded.
- B
Grant the Lambda function permissions to read from the source S3 bucket and write to the destination S3 bucket using an IAM role.
- C
Enable S3 Transfer Acceleration on both the source and destination buckets.
- D
Set the ACL of the resized images in the destination bucket to 'public-read'.
- E
Use the AWS SDK in the Lambda function to explicitly create a signed URL for each resized image.
Show answer and explanation
Correct answers: A, B, D
Explanation
To implement the described functionality, the Lambda function must be triggered by S3 events, which requires configuring an event notification on the source bucket. The Lambda function also needs appropriate IAM permissions to access the source and destination buckets. Finally, to make the resized images publicly accessible, setting their ACL to 'public-read' is sufficient. S3 Transfer Acceleration and signed URLs are not necessary for this specific use case.
- A. Correct.
Correct. To trigger the Lambda function when an image is uploaded, an S3 event notification must be configured on the source bucket.
- B. Correct.
Correct. The Lambda function requires appropriate IAM permissions to access the source bucket and write resized images to the destination bucket.
- C. Incorrect.
Incorrect. S3 Transfer Acceleration is used to speed up data transfers over long distances but is not required for this use case.
- D. Correct.
Correct. Setting the ACL to 'public-read' ensures that the resized images are publicly accessible.
- E. Incorrect.
Incorrect. Explicitly creating signed URLs is not required in this scenario since setting the ACL of the resized images to 'public-read' achieves the requirement of making them publicly accessible.