The APIs provided by this jslib operate synchronously, which means k6 must wait for operations that use the client classes to finish before proceeding with the rest of the script.
Performance considerations and recommended practices
In some cases, such as downloading large files from S3, this could affect performance and test results. To minimize the impact on test performance, we recommend using these operations in thesetup and teardown lifecycle functions. These functions run before and after the test run and thus do not influence test results.
S3Client allows interacting with AWS S3's buckets and objects. Namely, it allows the user to list buckets and the objects they contain, as well as download, uploading, and deleting objects. The S3Client operations are blocking, and we recommend reserving their usage to the setup and teardown functions as much as possible.
S3Client is included in both the dedicated jslib s3.js bundle, and the aws.js one, containing all the services clients.
|listBuckets()||List the buckets the authenticated user has access to|
|listObjects(bucketName, [prefix])||List the objects contained in a bucket|
|getObject(bucketName, objectKey)||Download an object from a bucket|
|putObject(bucketName, objectKey, data)||Upload an object to a bucket|
|deleteObject(bucketName, objectKey)||Delete an object from a bucket|
S3 Client methods will throw errors in case of failure.
|InvalidSignatureError||when invalid credentials were provided.|
|S3ServiceError||when AWS replied to the requested operation with an error.|