Bird
0
0

How can you ensure a Lambda function triggered by an S3 event only processes .png files?

hard📝 Application Q9 of 15
AWS - Lambda
How can you ensure a Lambda function triggered by an S3 event only processes .png files?
ACheck file extension inside the Lambda code and ignore others
BAdd a filter rule on the S3 event notification for suffix '.png'
CConfigure Lambda to only run on .png files in the runtime settings
DSet S3 bucket policy to allow only .png files
Step-by-Step Solution
Solution:
  1. Step 1: Use S3 event notification filters

    S3 event notifications support filter rules to trigger Lambda only for specific object key suffixes like '.png'.
  2. Step 2: Compare with other options

    Filtering inside Lambda wastes resources; runtime settings do not filter events; bucket policy controls access, not triggers.
  3. Final Answer:

    Add a filter rule on the S3 event notification for suffix '.png' -> Option B
  4. Quick Check:

    S3 event filters control Lambda triggers by file suffix [OK]
Quick Trick: Use S3 event filters to trigger Lambda only on desired file types [OK]
Common Mistakes:
  • Filtering inside Lambda instead of event trigger
  • Assuming runtime settings filter events
  • Misusing bucket policies for event filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes