aws-cdk-lib.aws_kms.IAlias

interface IAlias

LanguageType name
.NETAmazon.CDK.AWS.KMS.IAlias
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awskms#IAlias
Javasoftware.amazon.awscdk.services.kms.IAlias
Pythonaws_cdk.aws_kms.IAlias
TypeScript (source)aws-cdk-lib » aws_kms » IAlias

Implemented by Alias

Obtainable from Alias.fromAliasAttributes(), Alias.fromAliasName()

A KMS Key alias.

An alias can be used in all places that expect a key.

Properties

NameTypeDescription
aliasNamestringThe name of the alias.
aliasTargetKeyIKeyThe Key to which the Alias refers.
envResourceEnvironmentThe environment this resource belongs to.
keyArnstringThe ARN of the key.
keyIdstringThe ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab).
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

aliasName

Type: string

The name of the alias.


aliasTargetKey

Type: IKey

The Key to which the Alias refers.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


keyArn

Type: string

The ARN of the key.


keyId

Type: string

The ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab).


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAlias(alias)Defines a new alias for the key.
addToResourcePolicy(statement, allowNoOp?)Adds a statement to the KMS key resource policy.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
grant(grantee, ...actions)Grant the indicated permissions on this key to the given principal.
grantDecrypt(grantee)Grant decryption permissions using this key to the given principal.
grantEncrypt(grantee)Grant encryption permissions using this key to the given principal.
grantEncryptDecrypt(grantee)Grant encryption and decryption permissions using this key to the given principal.
grantGenerateMac(grantee)Grant permissions to generating MACs to the given principal.
grantVerifyMac(grantee)Grant permissions to verifying MACs to the given principal.

addAlias(alias)

public addAlias(alias: string): Alias

Parameters

  • alias string

Returns

  • Alias

Defines a new alias for the key.


addToResourcePolicy(statement, allowNoOp?)

public addToResourcePolicy(statement: PolicyStatement, allowNoOp?: boolean): AddToResourcePolicyResult

Parameters

  • statement PolicyStatement — The policy statement to add.
  • allowNoOp boolean — If this is set to false and there is no policy defined (i.e. external key), the operation will fail. Otherwise, it will no-op.

Returns

  • AddToResourcePolicyResult

Adds a statement to the KMS key resource policy.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

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).


grant(grantee, ...actions)

public grant(grantee: IGrantable, ...actions: string[]): Grant

Parameters

  • grantee IGrantable
  • actions string

Returns

  • Grant

Grant the indicated permissions on this key to the given principal.


grantDecrypt(grantee)

public grantDecrypt(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant decryption permissions using this key to the given principal.


grantEncrypt(grantee)

public grantEncrypt(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant encryption permissions using this key to the given principal.


grantEncryptDecrypt(grantee)

public grantEncryptDecrypt(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant encryption and decryption permissions using this key to the given principal.


grantGenerateMac(grantee)

public grantGenerateMac(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant permissions to generating MACs to the given principal.


grantVerifyMac(grantee)

public grantVerifyMac(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable

Returns

  • Grant

Grant permissions to verifying MACs to the given principal.