StringParameter L2 construct
Creates a new String SSM Parameter.
Example
const ssmParameter = new ssm.StringParameter(this, 'mySsmParameter', {
parameterName: 'mySsmParameter',
stringValue: 'mySsmParameterValue',
});
ssm_parameter = ssm.StringParameter(self, "mySsmParameter",
parameter_name="mySsmParameter",
string_value="mySsmParameterValue"
)
StringParameter ssmParameter = StringParameter.Builder.create(this, "mySsmParameter")
.parameterName("mySsmParameter")
.stringValue("mySsmParameterValue")
.build();
// Install: dotnet add package Amazon.CDK.Lib
var ssmParameter = new StringParameter(this, "mySsmParameter", new StringParameterProps {
ParameterName = "mySsmParameter",
StringValue = "mySsmParameterValue"
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
ssmParameter := ssm.NewStringParameter(this, jsii.String("mySsmParameter"), &StringParameterProps{
ParameterName: jsii.String("mySsmParameter"),
StringValue: jsii.String("mySsmParameterValue"),
})
Initializer
new StringParameter(scope: Construct, id: string, props: StringParameterProps)
StringParameter(scope: Construct, id: str, props: StringParameterProps)
new StringParameter(Construct scope, String id, StringParameterProps props)
new StringParameter(Construct scope, string id, StringParameterProps props)
NewStringParameter(Scope Construct, Id *string, Props StringParameterProps)
Construct Props
allowedPatternstringallowed_patternstrallowedPatternStringAllowedPatternstringAllowedPattern*string= no validation is performed#For example, for String types with values restricted to numbers, you can specify the following: ^\d+$
dataTypeParameterDataTypedata_typeParameterDataTypedataTypeParameterDataTypeDataTypeParameterDataTypeDataTypeParameterDataType= ParameterDataType.TEXT#parameterNamestringparameter_namestrparameterNameStringParameterNamestringParameterName*string= a name will be generated by Clou…#default
Default: a name will be generated by CloudFormation
simpleNamebooleansimple_nameboolsimpleNameBooleanSimpleNameboolSimpleName*bool= auto-detect based on `parameterN…#notes · default
A parameter name without any "/" is considered a simple name. If the parameter name includes "/", setting simpleName to true might cause unintended issues such as duplicate "/" in the resulting ARN.
This is required only if parameterName is a token, which means we are unable to detect if the name is simple or "path-like" for the purpose of rendering SSM parameter ARNs.
If parameterName is not specified, simpleName must be true (or undefined) since the name generated by AWS CloudFormation is always a simple name.
Default: auto-detect based on parameterName
It may not reference another parameter and {{}} cannot be used in the value.
typeParameterTypetypeParameterTypetypeParameterTypeTypeParameterTypeTypeParameterType= ParameterType.STRINGdeprecated#Properties
encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey= default master key#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
parameterNamestringparameter_namestrparameterNameStringParameterNamestringParameterName*stringrequired#parameterRefParameterReferenceparameter_refParameterReferenceparameterRefParameterReferenceParameterRefParameterReferenceParameterRefParameterReferencerequired#parameterTypestringparameter_typestrparameterTypeStringParameterTypestringParameterType*stringrequired#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#Value must not nest another parameter. Do not use {{}} in the value.
Methods
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromSecureStringParameterAttributes(scope: Construct, id: string, attrs: SecureStringParameterAttributes): IStringParameter@staticmethod def from_secure_string_parameter_attributes(scope: Construct, id: str, attrs: SecureStringParameterAttributes) -> IStringParameterpublic static IStringParameter fromSecureStringParameterAttributes(Construct scope, String id, SecureStringParameterAttributes attrs)public static IStringParameter FromSecureStringParameterAttributes(Construct scope, string id, SecureStringParameterAttributes attrs)func FromSecureStringParameterAttributes(Scope Construct, Id *string, Attrs SecureStringParameterAttributes) IStringParameterstatic#fromStringParameterArn(scope: Construct, id: string, stringParameterArn: string): IStringParameter@staticmethod def from_string_parameter_arn(scope: Construct, id: str, string_parameter_arn: str) -> IStringParameterpublic static IStringParameter fromStringParameterArn(Construct scope, String id, String stringParameterArn)public static IStringParameter FromStringParameterArn(Construct scope, string id, string stringParameterArn)func FromStringParameterArn(Scope Construct, Id *string, StringParameterArn *string) IStringParameterstatic#fromStringParameterAttributes(scope: Construct, id: string, attrs: StringParameterAttributes): IStringParameter@staticmethod def from_string_parameter_attributes(scope: Construct, id: str, attrs: StringParameterAttributes) -> IStringParameterpublic static IStringParameter fromStringParameterAttributes(Construct scope, String id, StringParameterAttributes attrs)public static IStringParameter FromStringParameterAttributes(Construct scope, string id, StringParameterAttributes attrs)func FromStringParameterAttributes(Scope Construct, Id *string, Attrs StringParameterAttributes) IStringParameterstatic#fromStringParameterName(scope: Construct, id: string, stringParameterName: string): IStringParameter@staticmethod def from_string_parameter_name(scope: Construct, id: str, string_parameter_name: str) -> IStringParameterpublic static IStringParameter fromStringParameterName(Construct scope, String id, String stringParameterName)public static IStringParameter FromStringParameterName(Construct scope, string id, string stringParameterName)func FromStringParameterName(Scope Construct, Id *string, StringParameterName *string) IStringParameterstatic#grantOnKey(grantee: IGrantable, ...actions: string[]): GrantOnKeyResultdef grant_on_key(self, grantee: IGrantable, actions: str) -> GrantOnKeyResultpublic GrantOnKeyResult grantOnKey(IGrantable grantee, String actions)public GrantOnKeyResult GrantOnKey(IGrantable grantee, string actions)func GrantOnKey(Grantee IGrantable, Actions *string) GrantOnKeyResult#grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#grantWrite(grantee: IGrantable): Grantdef grant_write(self, grantee: IGrantable) -> Grantpublic Grant grantWrite(IGrantable grantee)public Grant GrantWrite(IGrantable grantee)func GrantWrite(Grantee IGrantable) Grant#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#valueForSecureStringParameter(scope: Construct, parameterName: string, version: number): string@staticmethod def value_for_secure_string_parameter(scope: Construct, parameter_name: str, version: int | float) -> strpublic static String valueForSecureStringParameter(Construct scope, String parameterName, Number version)public static string ValueForSecureStringParameter(Construct scope, string parameterName, double version)func ValueForSecureStringParameter(Scope Construct, ParameterName *string, Version *float64) *stringstaticdeprecated#3 parameters
Parameters
scopescopescopescopeScope— Some scope within a stack.parameterNameparameter_nameparameterNameparameterNameParameterName— The name of the SSM parameter.versionversionversionversionVersion— The parameter version (required for secure strings).
valueForStringParameter(scope: Construct, parameterName: string, version?: number): string@staticmethod def value_for_string_parameter(scope: Construct, parameter_name: str, version: typing.Optional[int | float] = None) -> strpublic static String valueForStringParameter(Construct scope, String parameterName, Number version)public static string ValueForStringParameter(Construct scope, string parameterName, double? version = null)func ValueForStringParameter(Scope Construct, ParameterName *string, Version *float64) *stringstatic#3 parameters
Parameters
scopescopescopescopeScope— Some scope within a stack.parameterNameparameter_nameparameterNameparameterNameParameterName— The name of the SSM parameter.versionversionversionversionVersion— The parameter version (recommended in order to ensure that the value won't change during deployment).
valueForTypedStringParameter(scope: Construct, parameterName: string, type?: ParameterType, version?: number): string@staticmethod def value_for_typed_string_parameter(scope: Construct, parameter_name: str, type: typing.Optional[ParameterType] = None, version: typing.Optional[int | float] = None) -> strpublic static String valueForTypedStringParameter(Construct scope, String parameterName, ParameterType type, Number version)public static string ValueForTypedStringParameter(Construct scope, string parameterName, ParameterType? type = null, double? version = null)func ValueForTypedStringParameter(Scope Construct, ParameterName *string, Type ParameterType, Version *float64) *stringstaticdeprecated#4 parameters
Parameters
scopescopescopescopeScope— Some scope within a stack.parameterNameparameter_nameparameterNameparameterNameParameterName— The name of the SSM parameter.typetypetypetypeType— The type of the SSM parameter.versionversionversionversionVersion— The parameter version (recommended in order to ensure that the value won't change during deployment).
valueForTypedStringParameterV2(scope: Construct, parameterName: string, type?: ParameterValueType, version?: number): string@staticmethod def value_for_typed_string_parameter_v2(scope: Construct, parameter_name: str, type: typing.Optional[ParameterValueType] = None, version: typing.Optional[int | float] = None) -> strpublic static String valueForTypedStringParameterV2(Construct scope, String parameterName, ParameterValueType type, Number version)public static string ValueForTypedStringParameterV2(Construct scope, string parameterName, ParameterValueType? type = null, double? version = null)func ValueForTypedStringParameterV2(Scope Construct, ParameterName *string, Type ParameterValueType, Version *float64) *stringstatic#4 parameters
Parameters
scopescopescopescopeScope— Some scope within a stack.parameterNameparameter_nameparameterNameparameterNameParameterName— The name of the SSM parameter.typetypetypetypeType— The type of the SSM parameter.versionversionversionversionVersion— The parameter version (recommended in order to ensure that the value won't change during deployment).
valueFromLookup(scope: Construct, parameterName: string, defaultValue?: string, options?: StringParameterLookupOptions): string@staticmethod def value_from_lookup(scope: Construct, parameter_name: str, default_value: typing.Optional[str] = None, options: typing.Optional[StringParameterLookupOptions] = None) -> strpublic static String valueFromLookup(Construct scope, String parameterName, String defaultValue, StringParameterLookupOptions options)public static string ValueFromLookup(Construct scope, string parameterName, string? defaultValue = null, StringParameterLookupOptions? options = null)func ValueFromLookup(Scope Construct, ParameterName *string, DefaultValue *string, Options StringParameterLookupOptions) *stringstatic#notes
Requires that the stack this scope is defined in will have explicit account/region information. Otherwise, it will fail during synthesis.
If defaultValue is provided, it will be used as the dummyValue and the ContextProvider will be told NOT to raise an error on synthesis if the SSM Parameter is not found in the account at synth time.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.