Class StringParameter

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.ssm.StringParameter
All Implemented Interfaces:
IConstruct, IDependable, IResource, IParameter, IStringParameter, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:37.836Z") @Stability(Stable) public class StringParameter extends Resource implements IStringParameter, IParameter
Creates a new String SSM Parameter.

Example:

 IVpc vpc = Vpc.fromVpcAttributes(this, "VPC", VpcAttributes.builder()
         .vpcId("vpc-1234")
         .availabilityZones(List.of("us-east-1a", "us-east-1b"))
         // Either pass literals for all IDs
         .publicSubnetIds(List.of("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))
         .build());
 
  • Constructor Details

    • StringParameter

      protected StringParameter(software.amazon.jsii.JsiiObjectRef objRef)
    • StringParameter

      protected StringParameter(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • StringParameter

      @Stability(Stable) public StringParameter(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StringParameterProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromSecureStringParameterAttributes

      @Stability(Stable) @NotNull public static IStringParameter fromSecureStringParameterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SecureStringParameterAttributes attrs)
      Imports a secure string parameter from the SSM parameter store.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • fromStringParameterAttributes

      @Stability(Stable) @NotNull public static IStringParameter fromStringParameterAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StringParameterAttributes attrs)
      Imports an external string parameter with name and optional version.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • fromStringParameterName

      @Stability(Stable) @NotNull public static IStringParameter fromStringParameterName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stringParameterName)
      Imports an external string parameter by name.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      stringParameterName - This parameter is required.
    • valueForSecureStringParameter

      @Stability(Deprecated) @Deprecated @NotNull public static String valueForSecureStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @NotNull Number version)
      Deprecated.
      Use SecretValue.ssmSecure() instead, it will correctly type the imported value as a SecretValue and allow importing without version.
      (deprecated) Returns a token that will resolve (during deployment).

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      version - The parameter version (required for secure strings). This parameter is required.
    • valueForStringParameter

      @Stability(Stable) @NotNull public static String valueForStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable Number version)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      version - The parameter version (recommended in order to ensure that the value won't change during deployment).
    • valueForStringParameter

      @Stability(Stable) @NotNull public static String valueForStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
    • valueForTypedStringParameter

      @Stability(Stable) @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterType type, @Nullable Number version)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
      version - The parameter version (recommended in order to ensure that the value won't change during deployment).
    • valueForTypedStringParameter

      @Stability(Stable) @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName, @Nullable ParameterType type)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
      type - The type of the SSM parameter.
    • valueForTypedStringParameter

      @Stability(Stable) @NotNull public static String valueForTypedStringParameter(@NotNull software.constructs.Construct scope, @NotNull String parameterName)
      Returns a token that will resolve (during deployment) to the string value of an SSM string parameter.

      Parameters:
      scope - Some scope within a stack. This parameter is required.
      parameterName - The name of the SSM parameter. This parameter is required.
    • valueFromLookup

      @Stability(Stable) @NotNull public static String valueFromLookup(@NotNull Construct scope, @NotNull String parameterName)
      Reads the value of an SSM parameter during synthesis through an environmental context provider.

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

      Parameters:
      scope - This parameter is required.
      parameterName - This parameter is required.
    • grantRead

      @Stability(Stable) @NotNull public Grant grantRead(@NotNull IGrantable grantee)
      Grants read (DescribeParameter, GetParameter, GetParameterHistory) permissions on the SSM Parameter.

      Specified by:
      grantRead in interface IParameter
      Parameters:
      grantee - This parameter is required.
    • grantWrite

      @Stability(Stable) @NotNull public Grant grantWrite(@NotNull IGrantable grantee)
      Grants write (PutParameter) permissions on the SSM Parameter.

      Specified by:
      grantWrite in interface IParameter
      Parameters:
      grantee - This parameter is required.
    • getParameterArn

      @Stability(Stable) @NotNull public String getParameterArn()
      The ARN of the SSM Parameter resource.
      Specified by:
      getParameterArn in interface IParameter
    • getParameterName

      @Stability(Stable) @NotNull public String getParameterName()
      The name of the SSM Parameter resource.
      Specified by:
      getParameterName in interface IParameter
    • getParameterType

      @Stability(Stable) @NotNull public String getParameterType()
      The type of the SSM Parameter resource.
      Specified by:
      getParameterType in interface IParameter
    • getStringValue

      @Stability(Stable) @NotNull public String getStringValue()
      The parameter value.

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

      Specified by:
      getStringValue in interface IStringParameter
    • getEncryptionKey

      @Stability(Stable) @Nullable public IKey getEncryptionKey()
      The encryption key that is used to encrypt this parameter.

      • @default - default master key