Creates an alias for a customer master key (CMK).

Usage notes:

  • Each alias can be bound to only one CMK at a time.
  • The aliases of CMKs in the same region must be unique.

This topic provides an example on how to create an alias that is named alias/example for the CMK 1234abcd-12ab-34cd-56ef-12345678****.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateAlias

The operation that you want to perform. Set the value to CreateAlias.

AliasName String Yes alias/example

The name of the alias.

The name must be 1 to 255 characters in length and must include the alias/ prefix.

KeyId String Yes 1234abcd-12ab-34cd-56ef-12345678****

The globally unique ID of the CMK.

Response parameters

Parameter Type Example Description
RequestId String 1d2baaf3-d357-46c2-832e-13560c2bd9cd

The ID of the request.

Examples

Sample requests

https://kms.cn-hangzhou.aliyuncs.com/?Action=CreateAlias
&AliasName=alias/example
&KeyId=1234abcd-12ab-34cd-56ef-12345678****
&<Common request parameters>

Sample success responses

XML format

<KMS>
        <RequestId>1d2baaf3-d357-46c2-832e-13560c2bd9cd</RequestId>
</KMS>

JSON format

{
    "RequestId": "1d2baaf3-d357-46c2-832e-13560c2bd9cd"
}

Error codes

For a list of error codes, visit the API Error Center.