The CDK Construct Library for AWS::SSM
Project description
AWS Systems Manager Construct Library
This module is part of the AWS Cloud Development Kit project.
Installation
Install the module:
$ npm i @aws-cdk/aws-ssm
Import it into your code:
import ssm = require('@aws-cdk/aws-ssm');
Using existing SSM Parameters in your CDK app
You can reference existing SSM Parameter Store values that you want to use in
your CDK app by using ssm.ParameterStoreString
:
// Retrieve the latest value of the non-secret parameter
// with name "/My/String/Parameter".
const stringValue = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValue', {
parameterName: '/My/Public/Parameter',
// 'version' can be specified but is optional.
}).stringValue;
// Retrieve a specific version of the secret (SecureString) parameter.
// 'version' is always required.
const secretValue = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValue', {
parameterName: '/My/Secret/Parameter',
version: 5
});
Creating new SSM Parameters in your CDK app
You can create either ssm.StringParameter
or ssm.StringListParameter
s in
a CDK app. These are public (not secret) values. Parameters of type
SecretString cannot be created directly from a CDK application; if you want
to provision secrets automatically, use Secrets Manager Secrets (see the
@aws-cdk/aws-secretsmanager
package).
// Create a new SSM Parameter holding a String
const param = new ssm.StringParameter(stack, 'StringParameter', {
// description: 'Some user-friendly description',
// name: 'ParameterName',
stringValue: 'Initial parameter value',
// allowedPattern: '.*',
});
// Grant read access to some Role
param.grantRead(role);
// Create a new SSM Parameter holding a StringList
const listParameter = new ssm.StringListParameter(stack, 'StringListParameter', {
// description: 'Some user-friendly description',
// name: 'ParameterName',
stringListValue: ['Initial parameter value A', 'Initial parameter value B'],
// allowedPattern: '.*',
});
When specifying an allowedPattern
, the values provided as string literals
are validated against the pattern and an exception is raised if a value
provided does not comply.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws_cdk.aws_ssm-1.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c604c5e4c56f056828f45b9bf29fa0acd636dea3917004623e7ea733d0c10c2 |
|
MD5 | 9fbe5684a6d2296816c806a3aa04c4d5 |
|
BLAKE2b-256 | af9555f1feb624478e593670db408b57d8aebfdbe5014fcb32776a72e0ef6d49 |