Table of Contents

Class StringParameter

Namespace
Amazon.CDK.AWS.SSM
Assembly
Amazon.CDK.AWS.SSM.dll

Creates a new String SSM Parameter.

public class StringParameter : Resource, IStringParameter, IParameter, IResource, IConstruct, IConstruct, IDependable
Inheritance
StringParameter
Implements
IResource
IConstruct
IConstruct
IDependable

Examples

var vpc = Vpc.FromVpcAttributes(this, "VPC", new VpcAttributes {
                 VpcId = "vpc-1234",
                 AvailabilityZones = new [] { "us-east-1a", "us-east-1b" },

                 // Either pass literals for all IDs
                 PublicSubnetIds = new [] { "s-12345", "s-67890" },

                 // OR: import a list of known length
                 PrivateSubnetIds = Fn.ImportListValue("PrivateSubnetIds", 2),

                 // OR: split an imported string to a list of known length
                 IsolatedSubnetIds = Fn.Split(",", StringParameter.ValueForStringParameter(this, "MyParameter"), 2)
             });

Remarks

Resource: AWS::SSM::Parameter

ExampleMetadata: infused

Constructors

StringParameter(Construct, string, IStringParameterProps)

public StringParameter(Construct scope, string id, IStringParameterProps props)

Parameters

scope Construct
id string
props IStringParameterProps

Properties

EncryptionKey

The encryption key that is used to encrypt this parameter.

public virtual IKey? EncryptionKey { get; }

Property Value

IKey

Remarks

    ParameterArn

    The ARN of the SSM Parameter resource.

    public virtual string ParameterArn { get; }

    Property Value

    string

    ParameterName

    The name of the SSM Parameter resource.

    public virtual string ParameterName { get; }

    Property Value

    string

    ParameterType

    The type of the SSM Parameter resource.

    public virtual string ParameterType { get; }

    Property Value

    string

    StringValue

    The parameter value.

    public virtual string StringValue { get; }

    Property Value

    string

    Remarks

    Value must not nest another parameter. Do not use {{}} in the value.

    Methods

    FromSecureStringParameterAttributes(Construct, string, ISecureStringParameterAttributes)

    Imports a secure string parameter from the SSM parameter store.

    public static IStringParameter FromSecureStringParameterAttributes(Construct scope, string id, ISecureStringParameterAttributes attrs)

    Parameters

    scope Construct
    id string
    attrs ISecureStringParameterAttributes

    Returns

    IStringParameter

    FromStringParameterAttributes(Construct, string, IStringParameterAttributes)

    Imports an external string parameter with name and optional version.

    public static IStringParameter FromStringParameterAttributes(Construct scope, string id, IStringParameterAttributes attrs)

    Parameters

    scope Construct
    id string
    attrs IStringParameterAttributes

    Returns

    IStringParameter

    FromStringParameterName(Construct, string, string)

    Imports an external string parameter by name.

    public static IStringParameter FromStringParameterName(Construct scope, string id, string stringParameterName)

    Parameters

    scope Construct
    id string
    stringParameterName string

    Returns

    IStringParameter

    GrantRead(IGrantable)

    Grants read (DescribeParameter, GetParameter, GetParameterHistory) permissions on the SSM Parameter.

    public virtual Grant GrantRead(IGrantable grantee)

    Parameters

    grantee IGrantable

    Returns

    Grant

    GrantWrite(IGrantable)

    Grants write (PutParameter) permissions on the SSM Parameter.

    public virtual Grant GrantWrite(IGrantable grantee)

    Parameters

    grantee IGrantable

    Returns

    Grant

    ValueForSecureStringParameter(Construct, string, double)

    (deprecated) Returns a token that will resolve (during deployment).

    [Obsolete("Use `SecretValue.ssmSecure()` instead, it will correctly type the imported value as a `SecretValue` and allow importing without version.")]
    public static string ValueForSecureStringParameter(Construct scope, string parameterName, double version)

    Parameters

    scope Construct

    Some scope within a stack.

    parameterName string

    The name of the SSM parameter.

    version double

    The parameter version (required for secure strings).

    Returns

    string

    Remarks

    Stability: Deprecated

    ValueForStringParameter(Construct, string, double?)

    Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

    public static string ValueForStringParameter(Construct scope, string parameterName, double? version = null)

    Parameters

    scope Construct

    Some scope within a stack.

    parameterName string

    The name of the SSM parameter.

    version double?

    The parameter version (recommended in order to ensure that the value won't change during deployment).

    Returns

    string

    ValueForTypedStringParameter(Construct, string, ParameterType?, double?)

    Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

    public static string ValueForTypedStringParameter(Construct scope, string parameterName, ParameterType? type = null, double? version = null)

    Parameters

    scope Construct

    Some scope within a stack.

    parameterName string

    The name of the SSM parameter.

    type ParameterType?

    The type of the SSM parameter.

    version double?

    The parameter version (recommended in order to ensure that the value won't change during deployment).

    Returns

    string

    ValueFromLookup(Construct, string)

    Reads the value of an SSM parameter during synthesis through an environmental context provider.

    public static string ValueFromLookup(Construct scope, string parameterName)

    Parameters

    scope Construct
    parameterName string

    Returns

    string

    Remarks

    Requires that the stack this scope is defined in will have explicit account/region information. Otherwise, it will fail during synthesis.