Associates an existing AWS KMS alias with a different customer master key (CMK). Each alias is associated with only one CMK at a time, although a CMK can have multiple aliases. The alias and the CMK must be in the same AWS account and region.
The current and new CMK must be the same type (both symmetric or both asymmetric), and they must have the same key usage (ENCRYPT_DECRYPT
or SIGN_VERIFY
). This restriction prevents errors in code that uses aliases. If you must assign an alias to a different type of CMK, use DeleteAlias to delete the old alias and CreateAlias to create a new alias.
You cannot use UpdateAlias
to change an alias name. To change an alias name, use DeleteAlias to delete the old alias and CreateAlias to create a new alias.
Because an alias is not a property of a CMK, you can create, update, and delete the aliases of a CMK without affecting the CMK. Also, aliases do not appear in the response from the DescribeKey operation. To get the aliases of all CMKs in the account, use the ListAliases operation.
The CMK that you use for this operation must be in a compatible key state. For details, see How Key State Affects Use of a Customer Master Key in the AWS Key Management Service Developer Guide .
Cross-account use : No. You cannot perform this operation on a CMK in a different AWS account.
Required permissions
kms:UpdateAlias on the alias (IAM policy).
kms:UpdateAlias on the current CMK (key policy).
kms:UpdateAlias on the new CMK (key policy).
For details, see Controlling access to aliases in the AWS Key Management Service Developer Guide .
Related operations:
CreateAlias
DeleteAlias
ListAliases
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
update-alias
--alias-name <value>
--target-key-id <value>
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--alias-name
(string)
Identifies the alias that is changing its CMK. This value must begin with
alias/
followed by the alias name, such asalias/ExampleAlias
. You cannot use UpdateAlias to change the alias name.
--target-key-id
(string)
Identifies the customer managed CMK to associate with the alias. You don’t have permission to associate an alias with an AWS managed CMK .
The CMK must be in the same AWS account and Region as the alias. Also, the new target CMK must be the same type as the current target CMK (both symmetric or both asymmetric) and they must have the same key usage.
Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
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 CMK, use ListKeys or DescribeKey .
To verify that the alias is mapped to the correct CMK, use ListAliases .
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
To associate an alias with a different CMK
The following update-alias
example associates the alias alias/test-key
with a different CMK.
The --alias-name
parameter specifies the alias. The alias name value must begin with alias/
.
The --target-key-id
parameter specifies the CMK to associate with the alias. You don’t need to specify the current CMK for the alias.
aws kms update-alias \
--alias-name alias/test-key \
--target-key-id 1234abcd-12ab-34cd-56ef-1234567890ab
This command produces no output. To find the alias, use the list-aliases
command.
For more information, see Working with Aliases in the AWS Key Management Service Developer Guide.
None