KinesisClient
Caution
In some cases, using this library's operations might impact performance and skew your test results.
To ensure accurate results, consider executing these operations in thesetup
andteardown
lifecycle functions. These functions run before and after the test run and have no impact on the test results.
KinesisClient
interacts with the AWS Kinesis service.
With it, you can perform operations such as creating streams, putting records, listing streams, and reading records from streams. For a full list of supported operations, see Methods.
Both the dedicated kinesis.js
jslib bundle and the all-encompassing aws.js
bundle include the KinesisClient
.
Methods
Throws
KinesisClient methods will throw errors in case of failure.
Examples
Stream management
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 a stream with on-demand billing
await kinesis.createStream(streamName, {
streamModeDetails: {
streamMode: 'ON_DEMAND',
},
});
// List all streams
const streams = await kinesis.listStreams();
console.log('All streams:', streams.streamNames);
// Clean up - delete the stream
await kinesis.deleteStream(streamName);
console.log(`Deleted stream: ${streamName}`);
}