📢 Registration + agenda now live
Explore the latest Grafana Cloud and AI solutions, learn tips & tricks from demos and hands-on workshops, and get actionable advice to advance your observability strategy. Register now and get 50% off - limited tickets available (while they last!).
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
import exec from'k6/execution';import{
AWSConfig,
SecretsManagerClient,}from'https://jslib.k6.io/aws/0.14.0/secrets-manager.js';const awsConfig =newAWSConfig({region: __ENV.AWS_REGION,accessKeyId: __ENV.AWS_ACCESS_KEY_ID,secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,});const secretsManager =newSecretsManagerClient(awsConfig);const testSecretName ='jslib-test-secret';const testSecretValue ='jslib-test-value';exportdefaultasyncfunction(){// Let's make sure our test secret is createdconst testSecret =await secretsManager.createSecret(
testSecretName,
testSecretValue,'this is a test secret, delete me.');// Now that we know the secret exist, let's update its valueconst newTestSecretValue ='new-test-value';const u =await secretsManager.putSecretValue(testSecretName, newTestSecretValue);// Let's get its value back and verify it was indeed updatedconst updatedSecret =await secretsManager.getSecret(testSecretName);if(updatedSecret.secret !== newTestSecretValue){
exec.test.abort('unable to update test secret');}}
A k6 script that will update a secret’s value in AWS secrets manager