AliasProps

class aws_cdk.aws_kms.AliasProps(*, alias_name, target_key, removal_policy=None)

Bases: object

Construction properties for a KMS Key Alias object.

Parameters:
  • alias_name (str) – The name of the alias. The name must start with alias followed by a forward slash, such as alias/. You can’t specify aliases that begin with alias/AWS. These aliases are reserved.

  • target_key (IKey) – The ID of the key for which you are creating the alias. Specify the key’s globally unique identifier or Amazon Resource Name (ARN). You can’t specify another alias.

  • removal_policy (Optional[RemovalPolicy]) – Policy to apply when the alias is removed from this stack. Default: - The alias will be deleted

ExampleMetadata:

infused

Example:

# Passing an encrypted replication bucket created in a different stack.
app = App()
replication_stack = Stack(app, "ReplicationStack",
    env=Environment(
        region="us-west-1"
    )
)
key = kms.Key(replication_stack, "ReplicationKey")
alias = kms.Alias(replication_stack, "ReplicationAlias",
    # aliasName is required
    alias_name=PhysicalName.GENERATE_IF_NEEDED,
    target_key=key
)
replication_bucket = s3.Bucket(replication_stack, "ReplicationBucket",
    bucket_name=PhysicalName.GENERATE_IF_NEEDED,
    encryption_key=alias
)

Attributes

alias_name

The name of the alias.

The name must start with alias followed by a forward slash, such as alias/. You can’t specify aliases that begin with alias/AWS. These aliases are reserved.

removal_policy

Policy to apply when the alias is removed from this stack.

Default:
  • The alias will be deleted

target_key

The ID of the key for which you are creating the alias.

Specify the key’s globally unique identifier or Amazon Resource Name (ARN). You can’t specify another alias.