AWSConfig
AWSConfig is used to configure an AWS service client instance, such as S3Client or SecretsManagerClient. It effectively allows the user to select a region they wish to interact with, and the AWS credentials they wish to use to authenticate.
AWSConfig is included in the aws.js
bundle, which includes all the content of the library. It is also included in the various services clients dedicated bundles such as s3.js
and secrets-manager.js
.
It takes an options object as its single parameter, with the following properties:
Methods
Throws
S3 Client methods will throw errors in case of failure.
Example
import exec from 'k6/execution';
// Note that you AWSConfig is also included in the dedicated service
// client bundles such as `s3.js` and `secrets-manager.js`
import {
AWSConfig,
SecretsManagerClient,
} from 'https://jslib.k6.io/aws/0.12.3/aws.js';
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
});
const secretsManager = new SecretsManagerClient(awsConfig);
export default function () {
// ...
}
k6 will instantiate an AWSConfig
object and use it to configure a SecretsManagerClient
instance