All Products
Search
Document Center

Key Management Service:UpdateRotationPolicy

Last Updated:Apr 03, 2026

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

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: enables automatic key rotation.

  • false: disables automatic key rotation.

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.