Skip to content

Instantly share code, notes, and snippets.

@bahrmichael
Created May 28, 2019 11:19
Show Gist options
  • Save bahrmichael/c5c9eaf4733bc90344de84616407017f to your computer and use it in GitHub Desktop.
Save bahrmichael/c5c9eaf4733bc90344de84616407017f to your computer and use it in GitHub Desktop.
def handle(event, context):
print('Received %d records' % len(event['Records']))
for record in event['Records']:
# as we're using ttl to schedule executions, we do not care about inserts or updates,
# only about removes which happen after the ttl is hit
event_name = record['eventName']
if event_name != 'REMOVE':
print('Skipping %s' % event_name)
continue
# note that this image is in DynamoDB style, not a regular python object and needs to be converted accordingly
old_image = record['dynamodb']['OldImage']
print(old_image['payload'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment