Updates an alias to refer to a different CMK.
amazonkms.updateAlias(aliasName, newKeyId, [callback])
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
This method updates the alias named AliasName, changing it so that it refers to the CMK specified by NewKeyId.
The value passed for the AliasName parameter must include the alias/ prefix, and must be the name of an alias in the current account and Region
The value passed for the NewKeyId parameter must be the Id or ARN of a CMK in the current account and Region. The specified CMK must be of the same type (i.e., symmetric or asymmetric) and have the same usage (i.e., encryption/decryption or signing/verification) as the CMK that the alias currently refers to.
This method will fail if the specified alias is AWS-managed (i.e., its name begins with alias/aws/). This method will also fail if the specified CMK's state is aksPendingDeletion (2), or if it is AWS-managed (see KeyAWSManaged).