0
0
DynamoDBquery~10 mins

Event-driven architecture patterns in DynamoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the event source ARN in the DynamoDB Streams trigger.

DynamoDB
event_source_arn = "[1]"
Drag options to blanks, or click blank then click option'
Aarn:aws:lambda:us-east-1:123456789012:function:ProcessOrder
Barn:aws:s3:::mybucket
Carn:aws:dynamodb:us-east-1:123456789012:table/Orders/stream/2023-01-01T00:00:00.000
Darn:aws:sqs:us-east-1:123456789012:OrderQueue
Attempts:
3 left
💡 Hint
Common Mistakes
Using an ARN from S3 or Lambda instead of DynamoDB Streams ARN.
Missing the 'stream' part in the ARN.
2fill in blank
medium

Complete the code to specify the batch size for processing DynamoDB stream records.

DynamoDB
batch_size = [1]
Drag options to blanks, or click blank then click option'
A10
B1
C100
D1000
Attempts:
3 left
💡 Hint
Common Mistakes
Setting batch size too large causing delays.
Setting batch size to 1 causing inefficient processing.
3fill in blank
hard

Fix the error in the DynamoDB stream event handler code to correctly process the event records.

DynamoDB
def lambda_handler(event, context):
    for record in event['[1]']:
        print(record['eventName'])
Drag options to blanks, or click blank then click option'
Aevents
BRecords
Crecords
DEventRecords
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'records' which causes a KeyError.
Using incorrect key names like 'events' or 'EventRecords'.
4fill in blank
hard

Fill both blanks to create a DynamoDB stream event filter that only processes INSERT events.

DynamoDB
event_filter = {
    'eventName': ['[1]'],
    'eventSource': ['[2]']
}
Drag options to blanks, or click blank then click option'
AINSERT
BMODIFY
Cdynamodb.amazonaws.com
Daws:dynamodb
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'MODIFY' instead of 'INSERT' for eventName.
Using incorrect eventSource like 'dynamodb.amazonaws.com'.
5fill in blank
hard

Fill all three blanks to define a DynamoDB stream event handler that logs the new image keys for INSERT events.

DynamoDB
def lambda_handler(event, context):
    for record in event['[1]']:
        if record['eventName'] == '[2]':
            new_image = record['dynamodb']['[3]']
            print(new_image)
Drag options to blanks, or click blank then click option'
ARecords
BINSERT
CNewImage
DOldImage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'OldImage' instead of 'NewImage' for new data.
Using lowercase 'records' instead of 'Records'.