public class UpdateAliasRequest extends AmazonWebServiceRequest implements java.io.Serializable
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:
Constructor and Description |
---|
UpdateAliasRequest() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAliasName()
Identifies the alias that is changing its CMK.
|
java.lang.String |
getTargetKeyId()
Identifies the customer managed CMK to associate with the alias.
|
int |
hashCode() |
void |
setAliasName(java.lang.String aliasName)
Identifies the alias that is changing its CMK.
|
void |
setTargetKeyId(java.lang.String targetKeyId)
Identifies the customer managed CMK to associate with the alias.
|
java.lang.String |
toString()
Returns a string representation of this object; useful for testing and
debugging.
|
UpdateAliasRequest |
withAliasName(java.lang.String aliasName)
Identifies the alias that is changing its CMK.
|
UpdateAliasRequest |
withTargetKeyId(java.lang.String targetKeyId)
Identifies the customer managed CMK to associate with the alias.
|
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public java.lang.String getAliasName()
Identifies the alias that is changing its CMK. This value must begin with
alias/
followed by the alias name, such as
alias/ExampleAlias
. You cannot use UpdateAlias to change the
alias name.
Constraints:
Length: 1 - 256
Pattern: ^[a-zA-Z0-9:/_-]+$
Identifies the alias that is changing its CMK. This value must
begin with alias/
followed by the alias name, such
as alias/ExampleAlias
. You cannot use UpdateAlias to
change the alias name.
public void setAliasName(java.lang.String aliasName)
Identifies the alias that is changing its CMK. This value must begin with
alias/
followed by the alias name, such as
alias/ExampleAlias
. You cannot use UpdateAlias to change the
alias name.
Constraints:
Length: 1 - 256
Pattern: ^[a-zA-Z0-9:/_-]+$
aliasName
-
Identifies the alias that is changing its CMK. This value must
begin with alias/
followed by the alias name,
such as alias/ExampleAlias
. You cannot use
UpdateAlias to change the alias name.
public UpdateAliasRequest withAliasName(java.lang.String aliasName)
Identifies the alias that is changing its CMK. This value must begin with
alias/
followed by the alias name, such as
alias/ExampleAlias
. You cannot use UpdateAlias to change the
alias name.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 256
Pattern: ^[a-zA-Z0-9:/_-]+$
aliasName
-
Identifies the alias that is changing its CMK. This value must
begin with alias/
followed by the alias name,
such as alias/ExampleAlias
. You cannot use
UpdateAlias to change the alias name.
public java.lang.String getTargetKeyId()
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.
Constraints:
Length: 1 - 2048
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.
public void setTargetKeyId(java.lang.String targetKeyId)
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.
Constraints:
Length: 1 - 2048
targetKeyId
- 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.
public UpdateAliasRequest withTargetKeyId(java.lang.String targetKeyId)
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.
Returns a reference to this object so that method calls can be chained together.
Constraints:
Length: 1 - 2048
targetKeyId
- 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.
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.