Aliases in Amazon KMS - Amazon Key Management Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Aliases in Amazon KMS

An alias is a friendly name for a Amazon KMS key. For example, an alias lets you refer to a KMS key as test-key instead of 1234abcd-12ab-34cd-56ef-1234567890ab.

You can use an alias to identify a KMS key in the Amazon KMS console, in the DescribeKey operation, and in cryptographic operations, such as Encrypt and GenerateDataKey. Aliases also make it easy to recognize an Amazon managed key. Aliases for these KMS keys always have the form aws/<service-name>. For example, the alias for the Amazon managed key for Amazon DynamoDB is aws/dynamodb. You can establish similar alias standards for your projects, such as prefacing your aliases with the name of a project or category.

You can also allow and deny access to KMS keys based on their aliases without editing policies or managing grants. This feature is part of Amazon KMS support for attribute-based access control (ABAC). For details, see Use aliases to control access to KMS keys.

Much of the power of aliases come from your ability to change the KMS key associated with an alias at any time. Aliases can make your code easier to write and maintain. For example, suppose you use an alias to refer to a particular KMS key and you want to change the KMS key. In that case, just associate the alias with a different KMS key. You don't need to change your code.

Aliases also make it easier to reuse the same code in different Amazon Web Services Regions. Create aliases with the same name in multiple Regions and associate each alias with a KMS key in its Region. When the code runs in each Region, the alias refers to the associated KMS key in that Region. For an example, see Learn how to use aliases in your applications.

You can create an alias for a KMS key in the Amazon KMS console, by using the CreateAlias API, or by using the AWS::KMS::Alias Amazon CloudFormation template.

The Amazon KMS API provides full control of aliases in each account and Region. The API includes operations to create an alias (CreateAlias), view alias names and alias ARNs (ListAliases), change the KMS key associated with an alias (UpdateAlias), and delete an alias (DeleteAlias).

How aliases work

Learn how aliases work in Amazon KMS.

An alias is an independent Amazon resource

An alias is not a property of a KMS key. The actions that you take on the alias don't affect its associated KMS key. You can create an alias for a KMS key and then update the alias so it's associated with a different KMS key. You can even delete the alias without any effect on the associated KMS key. However, if you delete a KMS key, all aliases associated with that KMS key are deleted.

If you specify an alias as the resource in an IAM policy, the policy refers to the alias, not to the associated KMS key.

Each alias has two formats

When you create an alias, you specify the alias name. Amazon KMS creates the alias ARN for you.

  • An alias ARN is an Amazon Resource Name (ARN) that uniquely identifies the alias.

    # Alias ARN arn:aws:kms:us-west-2:111122223333:alias/<alias-name>
  • An alias name that is unique in the account and Region. In the Amazon KMS API, the alias name is always prefixed by alias/. That prefix is omitted in the Amazon KMS console.

    # Alias name alias/<alias-name>
Aliases are not secret

Aliases may be displayed in plaintext in CloudTrail logs and other output. Do not include confidential or sensitive information in the alias name.

Each alias is associated with one KMS key at a time

The alias and its KMS key must be in the same account and Region.

You can associate an alias with any customer managed key in the same Amazon Web Services account and Region. However, you do not have permission to associate an alias with an Amazon managed key.

For example, this ListAliases output shows that the test-key alias is associated with exactly one target KMS key, which is represented by the TargetKeyId property.

{ "AliasName": "alias/test-key", "AliasArn": "arn:aws:kms:us-west-2:111122223333:alias/test-key", "TargetKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "CreationDate": 1593622000.191, "LastUpdatedDate": 1593622000.191 }
Multiple aliases can be associated with the same KMS key

For example, you can associate the test-key and project-key aliases with the same KMS key.

{ "AliasName": "alias/test-key", "AliasArn": "arn:aws:kms:us-west-2:111122223333:alias/test-key", "TargetKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "CreationDate": 1593622000.191, "LastUpdatedDate": 1593622000.191 }, { "AliasName": "alias/project-key", "AliasArn": "arn:aws:kms:us-west-2:111122223333:alias/project-key", "TargetKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "CreationDate": 1516435200.399, "LastUpdatedDate": 1516435200.399 }
An alias must be unique in an account and Region

For example, you can have only one test-key alias in each account and Region. Aliases are case-sensitive, but aliases that differ only in their capitalization are very prone to error. You cannot change an alias name. However, you can delete the alias and create a new alias with the desired name.

You can create an alias with the same name in different Regions

For example, you can have a finance-key alias in US East (N. Virginia) and a finance-key alias in Europe (Frankfurt). Each alias would be associated with a KMS key in its Region. If your code refers to an alias name like alias/finance-key, you can run it in multiple Regions. In each Region, it uses a different KMS key. For details, see Learn how to use aliases in your applications.

You can change the KMS key associated with an alias

You can use the UpdateAlias operation to associate an alias with a different KMS key. For example, if the finance-key alias is associated with the 1234abcd-12ab-34cd-56ef-1234567890ab KMS key, you can update it so it is associated with the 0987dcba-09fe-87dc-65ba-ab0987654321 KMS key.

However, the current and new KMS key must be the same type (both symmetric or both asymmetric or both HMAC), and they must have the same key usage (ENCRYPT_DECRYPT or SIGN_VERIFY or GENERATE_VERIFY_MAC). This restriction prevents errors in code that uses aliases. If you must associate an alias with a different type of key, and you have mitigated the risks, you can delete and recreate the alias.

Some KMS keys don't have aliases

When you create a KMS key in the Amazon KMS console, you must give it a new alias. But an alias is not required when you use the CreateKey operation to create a KMS key. Also, you can use the UpdateAlias operation to change the KMS key associated with an alias and the DeleteAlias operation to delete an alias. As a result, some KMS keys might have several aliases, and some might have none.

Amazon creates aliases in your account

Amazon creates aliases in your account for Amazon managed keys. These aliases have names of the form alias/aws/<service-name>, such as alias/aws/s3.

Some Amazon aliases have no KMS key. These predefined aliases are usually associated with an Amazon managed key when you start using the service.

Use aliases to identify KMS keys

You can use an alias name or alias ARN to identify a KMS key in cryptographic operations, DescribeKey, and GetPublicKey. (If the KMS key is in a different Amazon Web Services account, you must use its key ARN or alias ARN.) Aliases are not valid identifiers for KMS keys in other Amazon KMS operations. For information about the valid key identifiers for each Amazon KMS API operation, see the descriptions of the KeyId parameters in the Amazon Key Management Service API Reference.

You cannot use an alias name or alias ARN to identify a KMS key in an IAM policy. To control access to a KMS key based on its aliases, use the kms:RequestAlias or kms:ResourceAliases condition keys. For details, see ABAC for Amazon KMS.