Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/javascript-api/jslib/aws/systemsmanagerclient/systemsmanagerparameter/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at 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.
SystemsManagerParameter
SystemsManagerParameter.* methods querying the Systems Manager Service parameters return some SystemsManagerParameter instances. Namely, getParameter returns an array of SystemsManagerParameter objects. The SystemsManagerParameter object describes an Amazon Systems Manager Service parameter.
| Name | Type | Description |
|---|---|---|
SystemsManagerParameter.arn | string | The Amazon Resource Name (ARN) of the parameter |
SystemsManagerParameter.dataType | string | The data type of the parameter, such as text or aws:ec2:image. The default is text. |
SystemsManagerParameter.lastModifiedDate | number | Date the parameter was last changed or updated and the parameter version was created. |
SystemsManagerParameter.name | string | The friendly name of the parameter. |
SystemsManagerParameter.selector | string | Either the version number or the label used to retrieve the parameter value |
SystemsManagerParameter.sourceResult | string | The raw result or response from the source. |
SystemsManagerParameter.type | string | The type of parameter |
SystemsManagerParameter.value | string | The parameter value |
SystemsManagerParameter.version | string | The parameter version |
Example
import exec from 'k6/execution';
import {
AWSConfig,
SystemsManagerClient,
} from 'https://jslib.k6.io/aws/0.14.0/ssm.js';
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
sessionToken: __ENV.AWS_SESSION_TOKEN,
});
const systemsManager = new SystemsManagerClient(awsConfig);
const testParameterName = 'jslib-test-parameter';
const testParameterValue = 'jslib-test-value';
const testParameterSecretName = 'jslib-test-parameter-secret';
// this value was created with --type SecureString
const testParameterSecretValue = 'jslib-test-secret-value';
export default async function () {
// Currently the parameter needs to be created before hand
// Let's get its value
// getParameter returns a parameter object: e.g. {name: string, value: string...}
const parameter = await systemsManager.getParameter(testParameterName);
if (parameter.value !== testParameterValue) {
exec.test.abort('test parameter not found');
}
// Let's get the secret value with decryption
// destructure the parameter object to get to the values you want
const { value: encryptedParameterValue } = await systemsManager.getParameter(
testParameterSecretName,
true
);
if (encryptedParameterValue !== testParameterSecretValue) {
exec.test.abort('encrypted test parameter not found');
}
}A k6 script querying a user Systems Manager Service parameter
Was this page helpful?
Related resources from Grafana Labs

