Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/jslib/aws/kinesisclient/putrecords.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/jslib/aws/kinesisclient/putrecords/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
Menu
Open source
putRecords
KinesisClient.putRecords(streamName, records) puts multiple records into a Kinesis stream.
Parameters
| Parameter | Type | Description |
|---|---|---|
| streamName | string | The name of the Kinesis stream to put records into. |
| records | Array | An array of records to put into the stream. |
Records
Each record in the records array should be an object with the following properties:
| Property | Type | Description |
|---|---|---|
| data | string | The data payload of the record. |
| partitionKey | string | The partition key for the record. |
| explicitHashKey | string | Optional. The explicit hash key for the record. |
Returns
| Type | Description |
|---|---|
Promise<Object> | A Promise that fulfills with the put records response. |
Returns object
| Property | Type | Description |
|---|---|---|
| failedRecordCount | number | The number of records that failed to be put. |
| records | Array | An array of record results. |
Record result object
| Property | Type | Description |
|---|---|---|
| sequenceNumber | string | The sequence number of the record (if successful). |
| shardId | string | The shard ID where the record was placed (if successful). |
| errorCode | string | The error code (if the record failed). |
| errorMessage | string | The error message (if the record failed). |
Example
JavaScript
import {
AWSConfig,
KinesisClient,
} from 'https://jslib.k6.io/aws/0.14.0/kinesis.js';
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
});
const kinesis = new KinesisClient(awsConfig);
export default async function () {
const streamName = 'my-test-stream';
// Create records to put into the stream
const records = [
{
data: JSON.stringify({
message: 'Hello from k6!',
timestamp: Date.now(),
userId: 'user123',
}),
partitionKey: 'user123',
},
{
data: JSON.stringify({
message: 'Another message',
timestamp: Date.now(),
userId: 'user456',
}),
partitionKey: 'user456',
},
{
data: JSON.stringify({
message: 'Load test data',
timestamp: Date.now(),
userId: 'user789',
}),
partitionKey: 'user789',
explicitHashKey: '123456789012345678901234567890123456789',
},
];
// Put records into the stream
const result = await kinesis.putRecords(streamName, records);
console.log('Put records result:');
console.log('Failed record count:', result.failedRecordCount);
// Check individual record results
result.records.forEach((record, index) => {
if (record.errorCode) {
console.log(`Record ${index} failed: ${record.errorCode} - ${record.errorMessage}`);
} else {
console.log(
`Record ${index} succeeded: sequence=${record.sequenceNumber}, shard=${record.shardId}`
);
}
});
}Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.
Choose a product
Viewing: v2.0.x (latest)
Find another version
Scroll for more