Created
August 14, 2019 16:39
-
-
Save julie-mills/e7153d04b9313abd536a6d8b18cd70a8 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
exports.handler = async (event, context) => { | |
for (const record of event.Records) { | |
let platform = record.dynamodb['NewImage']['platform']['S']; | |
let amount = record.dynamodb['NewImage']['amount']['N']; | |
let data = ... // format according to your Redshift schema | |
var params = { | |
Data: data | |
StreamName: 'test' | |
PartitionKey: '1234' | |
}; | |
kinesis.putRecord(params, function(err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data); // successful response | |
}); | |
} | |
return `Successfully processed ${event.Records.length} records.`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment