Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/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: https://grafana.com/docs/k6/next/javascript-api/jslib/aws/secretsmanagerclient/deletesecret.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/k6/next/javascript-api/jslib/aws/secretsmanagerclient/deletesecret/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
deleteSecret
SecretsManagerClient.deleteSecret deletes a secret from AWS’ secrets manager.
Parameters
| Parameter | Type | Description |
|---|---|---|
| secretID | string | The ARN or name of the secret to update. |
| options | { recoveryWindow: 30, noRecovery: false } | Use options to control the deletion behavior. recoveryWindow defines how long a secret will remain “soft-deleted”, in days, before being hard-deleted. noRecovery set to true would hard-delete the secret immediately. Note that both options are exclusive. |
Returns
| Type | Description |
|---|---|
Promise<void> | A promise that will be resolved when the secret is deleted |
Example
import {
AWSConfig,
SecretsManagerClient,
} from 'https://jslib.k6.io/aws/0.14.0/secrets-manager.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);
const testSecretName = 'jslib-test-secret';
const testSecretValue = 'jslib-test-value';
export default async function () {
// Let's make sure our test secret is created
const testSecret = await secretsManager.createSecret(
testSecretName,
testSecretValue,
'this is a test secret, delete me.'
);
// Let's hard delete our test secret and verify it worked
await secretsManager.deleteSecret(testSecretName, { noRecovery: true });
}A k6 script that will delete a secret in AWS secrets manager
Was this page helpful?
Related resources from Grafana Labs

