CfnKey
- class aws_cdk.aws_kms.CfnKey(scope, id, *, bypass_policy_lockout_safety_check=None, description=None, enabled=None, enable_key_rotation=None, key_policy=None, key_spec=None, key_usage=None, multi_region=None, origin=None, pending_window_in_days=None, rotation_period_in_days=None, tags=None)
Bases:
CfnResource
The
AWS::KMS::Key
resource specifies an KMS key in AWS Key Management Service . You can use this resource to create symmetric encryption KMS keys, asymmetric KMS keys for encryption or signing, and symmetric HMAC KMS keys. You can useAWS::KMS::Key
to create multi-Region primary keys of all supported types. To replicate a multi-Region key, use theAWS::KMS::ReplicaKey
resource.If you change the value of the
KeySpec
,KeyUsage
,Origin
, orMultiRegion
properties of an existing KMS key, the update request fails, regardless of the value of the`UpdateReplacePolicy
attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`_ . This prevents you from accidentally deleting a KMS key by changing any of its immutable property values. > AWS KMS replaced the term customer master key (CMK) with AWS KMS key and KMS key . The concept has not changed. To prevent breaking changes, AWS KMS is keeping some variations of this term.You can use symmetric encryption KMS keys to encrypt and decrypt small amounts of data, but they are more commonly used to generate data keys and data key pairs. You can also use a symmetric encryption KMS key to encrypt data stored in AWS services that are integrated with AWS KMS . For more information, see Symmetric encryption KMS keys in the AWS Key Management Service Developer Guide .
You can use asymmetric KMS keys to encrypt and decrypt data or sign messages and verify signatures. To create an asymmetric key, you must specify an asymmetric
KeySpec
value and aKeyUsage
value. For details, see Asymmetric keys in AWS KMS in the AWS Key Management Service Developer Guide .You can use HMAC KMS keys (which are also symmetric keys) to generate and verify hash-based message authentication codes. To create an HMAC key, you must specify an HMAC
KeySpec
value and aKeyUsage
value ofGENERATE_VERIFY_MAC
. For details, see HMAC keys in AWS KMS in the AWS Key Management Service Developer Guide .You can also create symmetric encryption, asymmetric, and HMAC multi-Region primary keys. To create a multi-Region primary key, set the
MultiRegion
property totrue
. For information about multi-Region keys, see Multi-Region keys in AWS KMS in the AWS Key Management Service Developer Guide .You cannot use the
AWS::KMS::Key
resource to specify a KMS key with imported key material or a KMS key in a custom key store .Regions
AWS KMS CloudFormation resources are available in all Regions in which AWS KMS and AWS CloudFormation are supported. You can use the
AWS::KMS::Key
resource to create and manage all KMS key types that are supported in a Region.- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html
- CloudformationResource:
AWS::KMS::Key
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_kms as kms kms_key = kms.Key(self, "myKMSKey") my_bucket = s3.Bucket(self, "mySSEKMSEncryptedBucket", encryption=s3.BucketEncryption.KMS, encryption_key=kms_key, object_ownership=s3.ObjectOwnership.BUCKET_OWNER_ENFORCED ) cloudfront.Distribution(self, "myDist", default_behavior=cloudfront.BehaviorOptions( origin=origins.S3BucketOrigin.with_origin_access_control(my_bucket) ) ) # Add the following to scope down the key policy scoped_down_key_policy = { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:root" }, "Action": "kms:*", "Resource": "*" }, { "Effect": "Allow", "Principal": { "Service": "cloudfront.amazonaws.com" }, "Action": ["kms:Decrypt", "kms:Encrypt", "kms:GenerateDataKey*" ], "Resource": "*", "Condition": { "StringEquals": { "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>" } } } ] } cfn_key = (kms_key.node.default_child) cfn_key.key_policy = scoped_down_key_policy
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).bypass_policy_lockout_safety_check (
Union
[bool
,IResolvable
,None
]) – Skips (“bypasses”) the key policy lockout safety check. The default value is false. .. epigraph:: Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately. For more information, see Default key policy in the AWS Key Management Service Developer Guide . Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent PutKeyPolicy request on the KMS key. Default: - falsedescription (
Optional
[str
]) – A description of the KMS key. Use a description that helps you to distinguish this KMS key from others in the account, such as its intended use.enabled (
Union
[bool
,IResolvable
,None
]) – Specifies whether the KMS key is enabled. Disabled KMS keys cannot be used in cryptographic operations. WhenEnabled
istrue
, the key state of the KMS key isEnabled
. WhenEnabled
isfalse
, the key state of the KMS key isDisabled
. The default value istrue
. The actual key state of the KMS key might be affected by actions taken outside of CloudFormation, such as running the EnableKey , DisableKey , or ScheduleKeyDeletion operations. For information about the key states of a KMS key, see Key state: Effect on your KMS key in the AWS Key Management Service Developer Guide .enable_key_rotation (
Union
[bool
,IResolvable
,None
]) – Enables automatic rotation of the key material for the specified KMS key. By default, automatic key rotation is not enabled. AWS KMS supports automatic rotation only for symmetric encryption KMS keys (KeySpec
=SYMMETRIC_DEFAULT
). For asymmetric KMS keys, HMAC KMS keys, and KMS keys with OriginEXTERNAL
, omit theEnableKeyRotation
property or set it tofalse
. To enable automatic key rotation of the key material for a multi-Region KMS key, setEnableKeyRotation
totrue
on the primary key (created by usingAWS::KMS::Key
). AWS KMS copies the rotation status to all replica keys. For details, see Rotating multi-Region keys in the AWS Key Management Service Developer Guide . When you enable automatic rotation, AWS KMS automatically creates new key material for the KMS key one year after the enable date and every year thereafter. AWS KMS retains all key material until you delete the KMS key. For detailed information about automatic key rotation, see Rotating KMS keys in the AWS Key Management Service Developer Guide .key_policy (
Any
) –The key policy to attach to the KMS key. If you provide a key policy, it must meet the following criteria: - The key policy must allow the caller to make a subsequent PutKeyPolicy request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see Default key policy in the AWS Key Management Service Developer Guide . (To omit this condition, set
BypassPolicyLockoutSafetyCheck
to true.) - Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to AWS KMS . When you create a new AWS principal (for example, an IAM user or role), you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to AWS KMS . For more information, see Changes that I make are not always immediately visible in the AWS Identity and Access Management User Guide . If you do not provide a key policy, AWS KMS attaches a default key policy to the KMS key. For more information, see Default key policy in the AWS Key Management Service Developer Guide . A key policy document can include only the following characters: - Printable ASCII characters - Printable characters in the Basic Latin and Latin-1 Supplement character set - The tab (\u0009
), line feed (\u000A
), and carriage return (\u000D
) special characters Minimum :1
Maximum :32768
key_spec (
Optional
[str
]) – Specifies the type of KMS key to create. The default value,SYMMETRIC_DEFAULT
, creates a KMS key with a 256-bit symmetric key for encryption and decryption. In China Regions,SYMMETRIC_DEFAULT
creates a 128-bit symmetric key that uses SM4 encryption. You can’t change theKeySpec
value after the KMS key is created. For help choosing a key spec for your KMS key, see Choosing a KMS key type in the AWS Key Management Service Developer Guide . TheKeySpec
property determines the type of key material in the KMS key and the algorithms that the KMS key supports. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see AWS KMS condition keys in the AWS Key Management Service Developer Guide . .. epigraph:: If you change the value of theKeySpec
property on an existing KMS key, the update request fails, regardless of the value of the`UpdateReplacePolicy
attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`_ . This prevents you from accidentally deleting a KMS key by changing an immutable property value. > AWS services that are integrated with AWS KMS use symmetric encryption KMS keys to protect your data. These services do not support encryption with asymmetric KMS keys. For help determining whether a KMS key is asymmetric, see Identifying asymmetric KMS keys in the AWS Key Management Service Developer Guide . AWS KMS supports the following key specs for KMS keys: - Symmetric encryption key (default) -SYMMETRIC_DEFAULT
(AES-256-GCM) - HMAC keys (symmetric) -HMAC_224
-HMAC_256
-HMAC_384
-HMAC_512
- Asymmetric RSA key pairs (encryption and decryption or signing and verification) -RSA_2048
-RSA_3072
-RSA_4096
- Asymmetric NIST-recommended elliptic curve key pairs (signing and verification or deriving shared secrets) -ECC_NIST_P256
(secp256r1) -ECC_NIST_P384
(secp384r1) -ECC_NIST_P521
(secp521r1) - Other asymmetric elliptic curve key pairs (signing and verification) -ECC_SECG_P256K1
(secp256k1), commonly used for cryptocurrencies. - SM2 key pairs (encryption and decryption or signing and verification or deriving shared secrets) -SM2
(China Regions only) Default: - “SYMMETRIC_DEFAULT”key_usage (
Optional
[str
]) – Determines the cryptographic operations for which you can use the KMS key. The default value isENCRYPT_DECRYPT
. This property is required for asymmetric KMS keys and HMAC KMS keys. You can’t change theKeyUsage
value after the KMS key is created. .. epigraph:: If you change the value of theKeyUsage
property on an existing KMS key, the update request fails, regardless of the value of the`UpdateReplacePolicy
attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`_ . This prevents you from accidentally deleting a KMS key by changing an immutable property value. Select only one valid value. - For symmetric encryption KMS keys, omit the parameter or specifyENCRYPT_DECRYPT
. - For HMAC KMS keys (symmetric), specifyGENERATE_VERIFY_MAC
. - For asymmetric KMS keys with RSA key pairs, specifyENCRYPT_DECRYPT
orSIGN_VERIFY
. - For asymmetric KMS keys with NIST-recommended elliptic curve key pairs, specifySIGN_VERIFY
orKEY_AGREEMENT
. - For asymmetric KMS keys withECC_SECG_P256K1
key pairs specifySIGN_VERIFY
. - For asymmetric KMS keys with SM2 key pairs (China Regions only), specifyENCRYPT_DECRYPT
,SIGN_VERIFY
, orKEY_AGREEMENT
. Default: - “ENCRYPT_DECRYPT”multi_region (
Union
[bool
,IResolvable
,None
]) –Creates a multi-Region primary key that you can replicate in other AWS Regions . You can’t change the
MultiRegion
value after the KMS key is created. For a list of AWS Regions in which multi-Region keys are supported, see Multi-Region keys in AWS KMS in the ** . .. epigraph:: If you change the value of theMultiRegion
property on an existing KMS key, the update request fails, regardless of the value of the`UpdateReplacePolicy
attribute <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html>`_ . This prevents you from accidentally deleting a KMS key by changing an immutable property value. For a multi-Region key, set to this property totrue
. For a single-Region key, omit this property or set it tofalse
. The default value isfalse
. Multi-Region keys are an AWS KMS feature that lets you create multiple interoperable KMS keys in different AWS Regions . Because these KMS keys have the same key ID, key material, and other metadata, you can use them to encrypt data in one AWS Region and decrypt it in a different AWS Region without making a cross-Region call or exposing the plaintext data. For more information, see Multi-Region keys in the AWS Key Management Service Developer Guide . You can create a symmetric encryption, HMAC, or asymmetric multi-Region KMS key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store. To create a replica of this primary key in a different AWS Region , create an AWS::KMS::ReplicaKey resource in a CloudFormation stack in the replica Region. Specify the key ARN of this primary key. Default: - falseorigin (
Optional
[str
]) – The source of the key material for the KMS key. You cannot change the origin after you create the KMS key. The default isAWS_KMS
, which means that AWS KMS creates the key material. To create a KMS key with no key material (for imported key material), set this value toEXTERNAL
. For more information about importing key material into AWS KMS , see Importing Key Material in the AWS Key Management Service Developer Guide . You can ignoreENABLED
when Origin isEXTERNAL
. When a KMS key with OriginEXTERNAL
is created, the key state isPENDING_IMPORT
andENABLED
isfalse
. After you import the key material,ENABLED
updated totrue
. The KMS key can then be used for Cryptographic Operations. .. epigraph:: AWS CloudFormation doesn’t support creating anOrigin
parameter of theAWS_CLOUDHSM
orEXTERNAL_KEY_STORE
values. Default: - “AWS_KMS”pending_window_in_days (
Union
[int
,float
,None
]) –Specifies the number of days in the waiting period before AWS KMS deletes a KMS key that has been removed from a CloudFormation stack. Enter a value between 7 and 30 days. The default value is 30 days. When you remove a KMS key from a CloudFormation stack, AWS KMS schedules the KMS key for deletion and starts the mandatory waiting period. The
PendingWindowInDays
property determines the length of waiting period. During the waiting period, the key state of KMS key isPending Deletion
orPending Replica Deletion
, which prevents the KMS key from being used in cryptographic operations. When the waiting period expires, AWS KMS permanently deletes the KMS key. AWS KMS will not delete a multi-Region primary key that has replica keys. If you remove a multi-Region primary key from a CloudFormation stack, its key state changes toPendingReplicaDeletion
so it cannot be replicated or used in cryptographic operations. This state can persist indefinitely. When the last of its replica keys is deleted, the key state of the primary key changes toPendingDeletion
and the waiting period specified byPendingWindowInDays
begins. When this waiting period expires, AWS KMS deletes the primary key. For details, see Deleting multi-Region keys in the AWS Key Management Service Developer Guide . You cannot use a CloudFormation template to cancel deletion of the KMS key after you remove it from the stack, regardless of the waiting period. If you specify a KMS key in your template, even one with the same name, CloudFormation creates a new KMS key. To cancel deletion of a KMS key, use the AWS KMS console or the CancelKeyDeletion operation. For information about thePending Deletion
andPending Replica Deletion
key states, see Key state: Effect on your KMS key in the AWS Key Management Service Developer Guide . For more information about deleting KMS keys, see the ScheduleKeyDeletion operation in the AWS Key Management Service API Reference and Deleting KMS keys in the AWS Key Management Service Developer Guide .rotation_period_in_days (
Union
[int
,float
,None
]) – Specifies a custom period of time between each rotation date. If no value is specified, the default value is 365 days. The rotation period defines the number of days after you enable automatic key rotation that AWS KMS will rotate your key material, and the number of days between each automatic rotation thereafter. You can use the`kms:RotationPeriodInDays
<https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-rotation-period-in-days>`_ condition key to further constrain the values that principals can specify in theRotationPeriodInDays
parameter. For more information about rotating KMS keys and automatic rotation, see Rotating keys in the AWS Key Management Service Developer Guide . Default: - 365tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Assigns one or more tags to the replica key. .. epigraph:: Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see ABAC for AWS KMS in the AWS Key Management Service Developer Guide . For information about tags in AWS KMS , see Tagging keys in the AWS Key Management Service Developer Guide . For information about tags in CloudFormation, see Tag .
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
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
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- 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
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::KMS::Key'
- attr_arn
The Amazon Resource Name (ARN) of the KMS key, such as
arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
.For information about the key ARN of a KMS key, see Key ARN in the AWS Key Management Service Developer Guide .
- CloudformationAttribute:
Arn
- attr_key_id
The key ID of the KMS key, such as
1234abcd-12ab-34cd-56ef-1234567890ab
.For information about the key ID of a KMS key, see Key ID in the AWS Key Management Service Developer Guide .
- CloudformationAttribute:
KeyId
- bypass_policy_lockout_safety_check
Skips (“bypasses”) the key policy lockout safety check.
The default value is false.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
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.
- description
A description of the KMS key.
- enable_key_rotation
Enables automatic rotation of the key material for the specified KMS key.
- enabled
Specifies whether the KMS key is enabled.
Disabled KMS keys cannot be used in cryptographic operations.
- key_policy
The key policy to attach to the KMS key.
- key_spec
Specifies the type of KMS key to create.
- key_usage
//docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations>`_ for which you can use the KMS key. The default value is
ENCRYPT_DECRYPT
. This property is required for asymmetric KMS keys and HMAC KMS keys. You can’t change theKeyUsage
value after the KMS key is created.- Type:
Determines the `cryptographic operations <https
- 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)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- multi_region
Creates a multi-Region primary key that you can replicate in other AWS Regions .
- node
The tree node.
- origin
The source of the key material for the KMS key.
- pending_window_in_days
Specifies the number of days in the waiting period before AWS KMS deletes a KMS key that has been removed from a CloudFormation stack.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- rotation_period_in_days
Specifies a custom period of time between each rotation date.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
Assigns one or more tags to the replica key.
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 type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.