# CfnAliasProps

Struct · External

Properties for defining a `CfnAlias`.

Used as props by: [CfnAlias](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.CfnAlias.html)

- Source: Generated at build time
- Type last changed: v2.227.0 · 21 Nov 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kms as kms } from 'aws-cdk-lib';
const cfnAliasProps: kms.CfnAliasProps = {
  aliasName: 'aliasName',
  targetKeyId: 'targetKeyId',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_kms as kms

cfn_alias_props = kms.CfnAliasProps(
    alias_name="aliasName",
    target_key_id="targetKeyId"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.kms.*;

CfnAliasProps cfnAliasProps = CfnAliasProps.builder()
        .aliasName("aliasName")
        .targetKeyId("targetKeyId")
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.KMS;

var cfnAliasProps = new CfnAliasProps {
    AliasName = "aliasName",
    TargetKeyId = "targetKeyId"
};
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnAliasProps := &CfnAliasProps{
	AliasName: jsii.String("aliasName"),
	TargetKeyId: jsii.String("targetKeyId"),
}
```

## Properties

- `aliasName`: string (required) — Specifies the alias name. This value must begin with `alias/` followed by a name, such as `alias/ExampleAlias` .

  > If you change the value of the `AliasName` property, the existing alias is deleted and a new alias is created for the specified KMS key. This change can disrupt applications that use the alias. It can also allow or deny access to a KMS key affected by attribute-based access control (ABAC).

  The alias must be string of 1-256 characters. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name cannot begin with `alias/aws/` . The `alias/aws/` prefix is reserved for [AWS managed keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) .

- `targetKeyId`: string | [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) | [IReplicaKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IReplicaKeyRef.html) (required) — Associates the alias with the specified [customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) . The KMS key must be in the same AWS account and Region.

  A valid key ID is required. If you supply a null or empty string value, this operation returns an error.

  For help finding the key ID and ARN, see [Finding the key ID and ARN](https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html#find-cmk-id-arn) in the *AWS Key Management Service Developer Guide* .

  Specify the key ID or the key ARN of the KMS key.

  For example:

  - Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab`
  - Key ARN: `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab`

  To get the key ID and key ARN for a KMS key, use [ListKeys](https://docs.aws.amazon.com/kms/latest/APIReference/API_ListKeys.html) or [DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html) .
