Updates the automatic rotation policy of a CMK.
Operation description
When automatic key rotation is enabled, KMS automatically creates a key version after the preset rotation period arrives. In addition, KMS sets the new key version as the primary key version.
An automatic key rotation policy cannot be configured for the following keys:
-
Asymmetric key
-
Service-managed key
-
Bring your own key (BYOK) that is imported into KMS
-
Key that is not in the Enabled state
In this example, automatic key rotation is enabled for a CMK whose ID is 1234abcd-12ab-34cd-56ef-12345678****. The automatic rotation period is 30 days.
For more information about the access policy required by a RAM user or RAM role to call this API, see Resource Access Management.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| KeyId |
string |
Yes |
The ID of the customer master key (CMK). The ID must be globally unique. |
1234abcd-12ab-34cd-56ef-12345678**** |
| EnableAutomaticRotation |
boolean |
Yes |
Specifies whether to enable automatic key rotation. Valid values:
|
true |
| RotationInterval |
string |
No |
The period of automatic key rotation. Specify the value in the integer[unit] format. The following units are supported: d (day), h (hour), m (minute), and s (second). For example, you can use either 7d or 604800s to specify a seven-day period. The period can range from 7 days to 730 days. Note
If you set the EnableAutomaticRotation parameter to true, you must also specify this parameter. If you set the EnableAutomaticRotation parameter to false, you can leave this parameter unspecified. |
30d |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
efb1cbbd-a093-4278-bc03-639dd4fcc207 |
Examples
Success response
JSON format
{
"RequestId": "efb1cbbd-a093-4278-bc03-639dd4fcc207"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Rejected.UnsupportedOperation | Unsupported operation. | The operation is not supported. |
| 400 | InvalidParameter | The specified parameter RotationInterval is not valid. | Invalid RotationInterval parameter value. |
| 404 | Forbidden.KeyNotFound | The specified Key is not found. | The error message returned because the specified CMK does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.