interface IAlias
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.KMS.IAlias |
Java | software.amazon.awscdk.services.kms.IAlias |
Python | aws_cdk.aws_kms.IAlias |
TypeScript (source) | @aws-cdk/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
Name | Type | Description |
---|---|---|
alias | string | The name of the alias. |
alias | IKey | The Key to which the Alias refers. |
env | Resource | The environment this resource belongs to. |
key | string | The ARN of the key. |
key | string | The ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab). |
node | Construct | The construct tree node for this construct. |
stack | Stack | The 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:
Resource
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:
Construct
The construct tree node for this construct.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | Defines a new alias for the key. |
add | Adds a statement to the KMS key resource policy. |
apply | Apply the given removal policy to this resource. |
grant(grantee, ...actions) | Grant the indicated permissions on this key to the given principal. |
grant | Grant decryption permissions using this key to the given principal. |
grant | Grant encryption permissions using this key to the given principal. |
grant | Grant encryption and decryption permissions using this key to the given principal. |
Alias(alias)
addpublic addAlias(alias: string): Alias
Parameters
- alias
string
Returns
Defines a new alias for the key.
ToResourcePolicy(statement, allowNoOp?)
addpublic addToResourcePolicy(statement: PolicyStatement, allowNoOp?: boolean): AddToResourcePolicyResult
Parameters
- statement
Policy
— The policy statement to add.Statement - allowNoOp
boolean
— If this is set tofalse
and there is no policy defined (i.e. external key), the operation will fail. Otherwise, it will no-op.
Returns
Adds a statement to the KMS key resource policy.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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 the indicated permissions on this key to the given principal.
Decrypt(grantee)
grantpublic grantDecrypt(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant decryption permissions using this key to the given principal.
Encrypt(grantee)
grantpublic grantEncrypt(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant encryption permissions using this key to the given principal.
EncryptDecrypt(grantee)
grantpublic grantEncryptDecrypt(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant encryption and decryption permissions using this key to the given principal.