Skip to content

Instantly share code, notes, and snippets.

@julie-mills
Created August 14, 2019 16:39
Show Gist options
  • Save julie-mills/e7153d04b9313abd536a6d8b18cd70a8 to your computer and use it in GitHub Desktop.
Save julie-mills/e7153d04b9313abd536a6d8b18cd70a8 to your computer and use it in GitHub Desktop.
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