Complete the code to specify the event source for the Lambda function.
EventSourceArn: [1]The event source ARN must point to the DynamoDB stream ARN to trigger the Lambda function on stream events.
Complete the code to set the batch size for processing records from the stream.
BatchSize: [1]BatchSize controls how many records the Lambda function receives at once. 100 is a common default for DynamoDB streams.
Fix the error in the Lambda function handler to correctly process DynamoDB stream records.
def lambda_handler(event, context): for record in [1]: print(record['dynamodb']['Keys'])
The DynamoDB stream records are inside the 'Records' key of the event object, with uppercase 'R'.
Fill both blanks to filter only INSERT events and extract the new image from the record.
for record in event['Records']: if record['eventName'] == [1]: new_image = record['dynamodb'][[2]]
To process only new inserts, check if eventName is 'INSERT' and get the 'NewImage' from the record.
Fill all three blanks to configure the Lambda event source mapping with batch size, starting position, and enable the mapping.
response = lambda_client.create_event_source_mapping(
EventSourceArn=[1],
FunctionName=[2],
BatchSize=[3],
StartingPosition='TRIM_HORIZON',
Enabled=True
)The EventSourceArn must be the DynamoDB stream ARN, FunctionName is the Lambda function's name, and BatchSize is set to 100 for efficient processing.