Skip to content

Instantly share code, notes, and snippets.

@erayalakese
Created September 5, 2022 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erayalakese/eff9f062e8a728576627a0dac0e72ce2 to your computer and use it in GitHub Desktop.
Save erayalakese/eff9f062e8a728576627a0dac0e72ce2 to your computer and use it in GitHub Desktop.
const { KinesisClient, PutRecordsCommand } = require("@aws-sdk/client-kinesis");
const kinesisClient = new KinesisClient({
region: "eu-central-1"
});
(async function() {
const recordData = [
{
Data: Buffer.from(JSON.stringify({
name: "cta-clicked",
time: new Date()
})),
PartitionKey: 'SERVICE_NAME' // Must be a string.
}
]
const data = await kinesisClient.send(new PutRecordsCommand({
Records: recordData,
StreamName: 'events'
}));
console.log(data)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment