SystemsManagerClient
Open source
RSS
SystemsManagerClient
SystemsManagerClient
interacts with the AWS Systems Manager Service.
With it, the user can get parameters from the Systems Manager Service in the caller’s AWS account and region.
Both the dedicated ssm.js
jslib bundle and the all-encompassing aws.js
bundle include the SystemsManagerClient
.
Methods
Function | Description |
---|---|
getParameter | Retrieves a parameter from Amazon Systems Manager. |
Throws
SystemsManagerClient
methods throw errors in case of failure.
Error | Condition |
---|---|
InvalidSignatureError | when using invalid credentials |
SystemsManagerServiceError | when AWS replied to the requested operation with an error |
Example
JavaScript
import exec from 'k6/execution';
import {
AWSConfig,
SystemsManagerClient,
} from 'https://jslib.k6.io/aws/0.12.3/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’s Systems Manager Service parameter
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
08 May

k6 1.0: How this long-awaited major release makes it easier to get started with testing
Grafana k6 v1.0 is here! k6 contributors will demonstrate features in the open source load testing tool, such as native extensibility (no more xk6 workarounds); the OpenAPI converter to streamline and automate the creation of TypeScript-based tests; and k6 Studio, a desktop application that simplifies performance testing for everyone.
60 min

Performance testing and observability in Grafana Cloud
In this webinar, learn how Grafana Cloud k6 offers you the best developer experience for performance testing.
60 min

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.