When a new file is uploaded to an S3 bucket, which event trigger configuration will cause a Lambda function to run automatically?
Think about which S3 event directly relates to new file uploads and can invoke Lambda automatically.
The 's3:ObjectCreated:*' event triggers Lambda when a new object is created in the bucket. CloudWatch alarms and SNS require manual or indirect setup. Versioning alone does not trigger Lambda.
You want a Lambda function to run every day at midnight automatically. Which AWS service should you use to trigger it?
Consider which service is designed to run tasks on a schedule.
Amazon EventBridge (formerly CloudWatch Events) supports scheduled rules to trigger Lambda functions at fixed times. CloudTrail and Config track changes but don't schedule tasks. SNS requires manual message publishing.
To allow an S3 bucket to trigger a Lambda function on object creation, which IAM permission must be granted?
Think about what permission allows one service to call another.
S3 needs permission to invoke the Lambda function, which is granted by allowing the 'lambda:InvokeFunction' action to the S3 service principal. The other permissions are unrelated or incorrect for this trigger.
You configured an SQS queue to trigger a Lambda function. Sometimes the function processes the same message twice. What is the best way to reduce duplicates?
Consider how Lambda processes messages and what can cause duplicates.
Setting batch size to 1 and making the function idempotent helps handle retries and avoid duplicate effects. Deleting messages too early or disabling dead-letter queues can cause message loss or unhandled failures.
A Lambda function is triggered by DynamoDB Streams on table updates. If the function keeps failing for the same batch of records, what is the expected behavior?
Think about how Lambda handles stream event retries and retention.
Lambda retries the same batch until it succeeds or the records expire from the DynamoDB stream (usually 24 hours). It does not skip or delete records automatically, nor disables itself.