-
-
Save beabetterdevv/fa43d1419732e6ec2e195b1e987c7327 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
firehose_client = boto3.client('firehose') | |
def lambda_handler(event, context): | |
resultString = "" | |
for record in event['Records']: | |
parsedRecord = parseRawRecord(record['dynamodb']) | |
resultString = resultString + json.dumps(parsedRecord) + "\n" | |
print(resultString) | |
response = firehose_client.put_record( | |
DeliveryStreamName="ChangeMe!!!!", | |
Record={ | |
'Data': resultString | |
} | |
) | |
def parseRawRecord(record): | |
result = {} | |
result["orderId"] = record['NewImage']['orderId']['S'] | |
result["state"] = record['NewImage']['state']['S'] | |
result["lastUpdatedDate"] = record['NewImage']['lastUpdatedDate']['N'] | |
return result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment