CfnParameter

class aws_cdk.core.CfnParameter(scope, id, *, allowed_pattern=None, allowed_values=None, constraint_description=None, default=None, description=None, max_length=None, max_value=None, min_length=None, min_value=None, no_echo=None, type=None)

Bases: aws_cdk.core.CfnElement

A CloudFormation parameter.

Use the optional Parameters section to customize your templates. Parameters enable you to input custom values to your template each time you create or update a stack.

__init__(scope, id, *, allowed_pattern=None, allowed_values=None, constraint_description=None, default=None, description=None, max_length=None, max_value=None, min_length=None, min_value=None, no_echo=None, type=None)

Creates a parameter construct. Note that the name (logical ID) of the parameter will derive from it’s coname and location within the stack. Therefore, it is recommended that parameters are defined at the stack level.

Parameters
  • scope (Construct) – The parent construct.

  • id (str) –

  • props – The parameter properties.

  • allowed_pattern (Optional[str]) – A regular expression that represents the patterns to allow for String types. Default: - No constraints on patterns allowed for parameter.

  • allowed_values (Optional[List[str]]) – An array containing the list of values allowed for the parameter. Default: - No constraints on values allowed for parameter.

  • constraint_description (Optional[str]) – A string that explains a constraint when the constraint is violated. For example, without a constraint description, a parameter that has an allowed pattern of [A-Za-z0-9]+ displays the following error message when the user specifies an invalid value:. Default: - No description with customized error message when user specifies invalid values.

  • default (Optional[Any]) – A value of the appropriate type for the template to use if no value is specified when a stack is created. If you define constraints for the parameter, you must specify a value that adheres to those constraints. Default: - No default value for parameter.

  • description (Optional[str]) – A string of up to 4000 characters that describes the parameter. Default: - No description for the parameter.

  • max_length (Union[int, float, None]) – An integer value that determines the largest number of characters you want to allow for String types. Default: - None.

  • max_value (Union[int, float, None]) – A numeric value that determines the largest numeric value you want to allow for Number types. Default: - None.

  • min_length (Union[int, float, None]) – An integer value that determines the smallest number of characters you want to allow for String types. Default: - None.

  • min_value (Union[int, float, None]) – A numeric value that determines the smallest numeric value you want to allow for Number types. Default: - None.

  • no_echo (Optional[bool]) – Whether to mask the parameter value when anyone makes a call that describes the stack. If you set the value to true, the parameter value is masked with asterisks (*****). Default: - Parameter values are not masked.

  • type (Optional[str]) – The data type for the parameter (DataType). Default: String

Return type

None

Methods

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

resolve(_context)
Parameters

_context (IResolveContext) –

Return type

Any

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

creation_stack

return :rtype: List[str] :return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

return :rtype: str :return:

the logical ID as a stringified token. This value will only get resolved during synthesis.

no_echo

Indicates if this parameter is configured with “NoEcho” enabled.

Return type

bool

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

value

The parameter value as a Token.

Return type

IResolvable

value_as_list

The parameter value, if it represents a string list.

Return type

List[str]

value_as_number

The parameter value, if it represents a number.

Return type

Union[int, float]

value_as_string

The parameter value, if it represents a string.

Return type

str

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

return :rtype: bool :return: The construct as a stack element or undefined if it is not a stack element.

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool