All Products
Search
Document Center

Key Management Service:RotateSecret

Last Updated:Jul 29, 2025

Manually rotates a secret.

Operation description

Limits:

• A secret of each Alibaba Cloud account can be rotated for a maximum of 50 times per hour.

• The RotateSecret operation is unavailable for standard secrets.

In this example, the RdsSecret/Mysql5.4/MyCred secret is manually rotated, and the version number of the secret is set to 000000123 after the secret is rotated.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
SecretNamestringYes

The name of the secret.

RdsSecret/Mysql5.4/MyCred
VersionIdstringYes

The version number of the secret after the secret is rotated.

Note The version number is used to ensure the idempotence of the request. Secrets Manager uses this version number to prevent your application from creating the same version of the secret when the application retries a request. If a version number already exists, Secrets Manager ignores the request for rotation and returns a success message.
000000123

Response parameters

ParameterTypeDescriptionExample
object
VersionIdstring

The version number of the secret after the secret is rotated.

000000123
SecretNamestring

The name of the secret.

RdsSecret/Mysql5.4/MyCred
RequestIdstring

The ID of the request.

10257c86-269d-43aa-aaf3-90ed4144bb7c
Arnstring

The Alibaba Cloud Resource Name (ARN) of the secret.

acs:kms:cn-hangzhou:154035569884****:secret/RdsSecret/Mysql5.4/MyCred

Examples

Sample success responses

JSONformat

{
  "VersionId": "000000123",
  "SecretName": "RdsSecret/Mysql5.4/MyCred",
  "RequestId": "10257c86-269d-43aa-aaf3-90ed4144bb7c",
  "Arn": "acs:kms:cn-hangzhou:154035569884****:secret/RdsSecret/Mysql5.4/MyCred"
}

Error codes

For a list of error codes, visit the Service error codes.