# Alias

Defines a display name for a customer master key (CMK) in AWS Key Management Service (AWS KMS).

Using an alias to refer to a key can help you simplify key
management. For example, when rotating keys, you can just update the alias
mapping instead of tracking and changing key IDs. For more information, see
Working with Aliases in the AWS Key Management Service Developer Guide.

You can also add an alias for a key by calling `key.addAlias(alias)`.

Extends: Construct › Resource › Alias
Implements: IResource, IAlias, IKey, IEnvironmentAware, IAliasRef, IKeyRef, IConstruct, IDependable

- CloudFormation: [`AWS::KMS::Alias`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-kms-alias.html)
- L1 type: [`CfnAlias`](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.CfnAlias.html)
- Source: [`aws-kms/lib/alias.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-kms/lib/alias.ts#L214)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

```ts
// Passing an encrypted replication bucket created in a different stack.
const app = new App();
const replicationStack = new Stack(app, 'ReplicationStack', {
  env: {
    region: 'us-west-1',
  },
});
const key = new kms.Key(replicationStack, 'ReplicationKey');
const alias = new kms.Alias(replicationStack, 'ReplicationAlias', {
  // aliasName is required
  aliasName: PhysicalName.GENERATE_IF_NEEDED,
  targetKey: key,
});
const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', {
  bucketName: PhysicalName.GENERATE_IF_NEEDED,
  encryptionKey: alias,
});
```

## Initializer

```ts
new Alias(scope: Construct, id: string, props: AliasProps)
```

## Construct Props

- `aliasName`: string (required) — 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.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) — Policy to apply when the alias is removed from this stack.

  **Default:** The alias will be deleted

- `targetKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) (required) — 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.

## Properties

- `aliasArn`: string — The ARN of the alias.

- `aliasName`: string — The name of the alias.

- `aliasRef`: [AliasReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.AliasReference.html) — A reference to a Alias resource.

- `aliasTargetKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The Key to which the Alias refers.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `keyArn`: string — use `aliasArn` instead

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

- `keyRef`: [KeyReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.KeyReference.html) — A reference to a Key resource.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addAlias(alias: string): Alias // chainable` — Defines a new alias for the key.

- `addToResourcePolicy(statement: PolicyStatement, allowNoOp?: boolean): AddToResourcePolicyResult` — Adds a statement to the KMS key resource policy.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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`).

- `fromAliasAttributes(scope: Construct, id: string, attrs: AliasAttributes): IAlias` (static) — Import an existing KMS Alias defined outside the CDK app.

  **Parameters**

  - `scope` — The parent creating construct (usually `this`).
  - `id` — The construct's name.
  - `attrs` — the properties of the referenced KMS Alias.

- `fromAliasName(scope: Construct, id: string, aliasName: string): IAlias` (static) — Import an existing KMS Alias defined outside the CDK app, by the alias name.

  This method should be used
  instead of 'fromAliasAttributes' when the underlying KMS Key ARN is not available.
  This Alias will not have a direct reference to the KMS Key, so addAlias method is not supported.

  If the `@aws-cdk/aws-kms:applyImportedAliasPermissionsToPrincipal` feature flag is set to `true`,
  the grant* methods will use the kms:ResourceAliases condition to grant permissions to the specific alias name.
  They will only modify the principal policy, not the key resource policy.
  Without the feature flag `grant*` methods will be a no-op.

  **Parameters**

  - `scope` — The parent creating construct (usually `this`).
  - `id` — The construct's name.
  - `aliasName` — The full name of the KMS Alias (e.g., 'alias/aws/s3', 'alias/myKeyAlias').

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — [disable-awslint:no-grants].

- `grantDecrypt(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantEncrypt(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantEncryptDecrypt(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantGenerateMac(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantSign(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantSignVerify(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantVerify(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `grantVerifyMac(grantee: IGrantable): Grant` — [disable-awslint:no-grants].

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  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 class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` 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 the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
