0
0
AWScloud~20 mins

Event triggers for Lambda in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Lambda Event Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does an S3 event trigger a Lambda function?

When a new file is uploaded to an S3 bucket, which event trigger configuration will cause a Lambda function to run automatically?

AConfigure the Lambda function with an S3 trigger for the 's3:ObjectCreated:*' event on the bucket.
BSet up a CloudWatch alarm on the bucket and link it to the Lambda function.
CCreate an SNS topic subscribed by the Lambda function and publish messages manually.
DEnable versioning on the bucket and link it to the Lambda function.
Attempts:
2 left
💡 Hint

Think about which S3 event directly relates to new file uploads and can invoke Lambda automatically.

Architecture
intermediate
2:00remaining
Which AWS service can trigger Lambda on a scheduled basis?

You want a Lambda function to run every day at midnight automatically. Which AWS service should you use to trigger it?

AAWS Config
BAWS CloudTrail
CAmazon SNS topic with daily messages
DAmazon EventBridge (CloudWatch Events) with a scheduled rule
Attempts:
2 left
💡 Hint

Consider which service is designed to run tasks on a schedule.

security
advanced
2:00remaining
What IAM permission is required for S3 to invoke a Lambda function?

To allow an S3 bucket to trigger a Lambda function on object creation, which IAM permission must be granted?

As3:PutObject permission granted to the Lambda execution role
Blambda:InvokeFunction permission granted to the S3 service principal
Clambda:CreateFunction permission granted to the S3 bucket
Diam:PassRole permission granted to the Lambda function
Attempts:
2 left
💡 Hint

Think about what permission allows one service to call another.

Best Practice
advanced
2:00remaining
How to avoid duplicate Lambda executions from SQS triggers?

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?

ADelete messages from the queue immediately after Lambda invocation starts.
BIncrease the Lambda timeout to avoid retries.
CEnable Lambda's event source mapping with batch size 1 and use idempotent processing in the function.
DDisable the SQS queue's dead-letter queue.
Attempts:
2 left
💡 Hint

Consider how Lambda processes messages and what can cause duplicates.

🧠 Conceptual
expert
2:00remaining
What happens if a Lambda function triggered by DynamoDB Streams fails repeatedly?

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?

ALambda retries processing the batch until successful or the data expires in the stream (24 hours).
BLambda skips the failed batch and moves to the next batch immediately.
CDynamoDB deletes the failed records from the stream after 5 retries.
DThe Lambda function is disabled automatically after 3 failures.
Attempts:
2 left
💡 Hint

Think about how Lambda handles stream event retries and retention.