Bird
0
0

You want an AWS Lambda function to automatically log the names of files uploaded to an S3 bucket. Which setup is the most appropriate?

hard📝 Best Practice Q8 of 15
AWS - Lambda
You want an AWS Lambda function to automatically log the names of files uploaded to an S3 bucket. Which setup is the most appropriate?
AManually invoke the Lambda function after each file upload
BSchedule the Lambda function to run every hour and scan the S3 bucket for new files
CConfigure S3 event notifications to trigger the Lambda function on 'ObjectCreated' events
DUse CloudWatch Logs to monitor S3 bucket and trigger Lambda
Step-by-Step Solution
Solution:
  1. Step 1: Understand event-driven architecture

    S3 can trigger Lambda on specific events like 'ObjectCreated'.
  2. Step 2: Choose automatic trigger

    Configure S3 event notifications to trigger the Lambda function on 'ObjectCreated' events uses S3 event notifications to invoke Lambda immediately on uploads.
  3. Step 3: Evaluate other options

    Schedule the Lambda function to run every hour and scan the S3 bucket for new files is inefficient polling; C is manual; D is incorrect as CloudWatch Logs doesn't monitor S3 directly.
  4. Final Answer:

    Configure S3 event notifications to trigger the Lambda function on 'ObjectCreated' events -> Option C
  5. Quick Check:

    S3 event notifications trigger Lambda on uploads [OK]
Quick Trick: Use S3 event notifications for automatic Lambda triggers [OK]
Common Mistakes:
MISTAKES
  • Using scheduled polling instead of event triggers
  • Manually invoking Lambda after uploads
  • Misunderstanding CloudWatch Logs role

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes