Complete the code to enable DynamoDB Streams for change tracking on a table.
aws dynamodb update-table --table-name MyTable --stream-specification StreamEnabled=[1],StreamViewType=NEW_AND_OLD_IMAGESSetting StreamEnabled=true activates DynamoDB Streams, which tracks changes.
Complete the code to read change events from a DynamoDB Stream using AWS CLI.
aws dynamodbstreams get-records --[1]The correct parameter name is ShardIterator in PascalCase.
Fix the error in the code to filter DynamoDB Stream events for INSERT operations only.
if event['eventName'] == '[1]': process(event)
The event name for new items added is INSERT.
Fill both blanks to create a DynamoDB Stream ARN for a table in region us-east-1.
arn:aws:dynamodb:[1]:123456789012:table/[2]/stream/2023-01-01T00:00:00.000
The region is 'us-east-1' and the table name is 'MyTable' to form the correct ARN.
Fill all three blanks to create a Python dictionary comprehension that maps item IDs to new values from DynamoDB Stream records where the event is INSERT.
result = {record['dynamodb']['Keys']['ID']['S']: record['dynamodb']['NewImage']['Value']['S'] for record in records if record['eventName'] == '[1]' and '[2]' in record['dynamodb']['NewImage'] and record['dynamodb']['NewImage']['Value']['S'] [3] ''}We filter for 'INSERT' events, check 'Value' key exists, and ensure the value is not empty using '!='.