Skip to main content

CreateAlias

Creates a friendly name (alias) for a KMS key.

Description

The `CreateAlias` operation creates a display name for a KMS key. An alias is a friendly name that you can use to identify a KMS key in the console and in some QKMS operations. Each alias is associated with exactly one KMS key at a time, but a KMS key can have multiple aliases.

note
  • Each alias must be unique in the account and region. To simplify key management, you can use the same alias in different regions to refer to different keys.
  • The alias name must begin with `alias/` followed by a name that contains only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-).
  • The alias name cannot begin with `alias/aws/` as this prefix is reserved for QKMS managed keys.

Request Syntax

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.CreateAlias"Yesstring

Request Body

NameDescriptionRequiredType
AliasNameThe alias name. The name must begin with 'alias/' followed by a name, such as 'alias/ExampleAlias'.Yesstring
TargetKeyIdThe unique identifier of the KMS key that the alias will be associated with. This value can be the key ID or the key ARN of the KMS key.Yesstring
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CreateAlias
{ "AliasName": "alias/ExampleAlias", "TargetKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab" }
Values in italics indicate user input and should be replaced with actual values.

Examples

Example 1: Create an alias for a KMS key

POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.CreateAlias
{ "AliasName": "alias/ExampleAlias", "TargetKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab" }
Values in italics indicate user input and should be replaced with actual values.
HTTP/1.1 200 OK
Content-Type: application/x-amz-json-1.1
Values in italics indicate variable response values.

Response Elements

This operation returns no response data.

Special Errors

Error CodeDescription
AlreadyExistsExceptionThe alias you are trying to create already exists.
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
InvalidAliasNameExceptionThe alias name is not valid.
KMSInternalExceptionAn internal error occurred.
KMSInvalidStateExceptionThe request was rejected because the key state is not valid for this operation.
LimitExceededExceptionThe request was rejected because a quota was exceeded.
NotFoundExceptionThe request was rejected because the specified key was not found.

Permissions

To use the `CreateAlias` operation, you must have the following permissions:

  • `kms:CreateAlias` on the alias (specified in the policy)
  • `kms:CreateAlias` on the KMS key (specified in the policy)

Try It Out

Test CreateAlias

Create an alias for a KMS key.

Coming Soon

This feature is currently under development and will be available soon.