Skip to content

SecretsManagerClient.rotate_secret

rboto-secrets-manager==0.4.0 · Service index · Types

Model summary (excerpt): Configures and starts the asynchronous process of rotating the secret. For information about rotation, see Rotate secrets in the Secrets Manager User Guide . If you include the configuration parameters, the operation sets the values for the secret and then immediately starts a rotation. If you don't include the configuration parameters, the operation starts a rotation with the values already...

Install and imports

python -m pip install "rboto[secrets-manager]==0.4.0"
from rboto import SecretsManagerClient
from collections.abc import Sequence
from rboto_secrets_manager.types import (
    ExternalSecretRotationMetadataItem,
    RotateSecretOutput,
    RotationRulesType,
)

Signature

async def rotate_secret(
    *,
    secret_id: str,
    client_request_token: str | None = None,
    rotation_lambda_arn: str | None = None,
    rotation_rules: RotationRulesType | None = None,
    external_secret_rotation_metadata: Sequence[ExternalSecretRotationMetadataItem] | None = None,
    external_secret_rotation_role_arn: str | None = None,
    rotate_immediately: bool | None = None,
) -> RotateSecretOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
secret_id Yes The ARN or name of the secret to rotate. For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See Finding a secret from a partial ARN .
client_request_token No A unique identifier for the new version of the secret. You only need to specify this value if you implement your own retry logic and you want to ensure that Secrets Manager doesn't attempt to create a secret version twice. If you use the Amazon Web Services CLI or one of the Amazon Web Services SDKs to call this operation, then you can leave this parameter empty. The CLI or SDK generates a...
rotation_lambda_arn No For secrets that use a Lambda rotation function to rotate, the ARN of the Lambda rotation function. For secrets that use managed rotation , omit this field. For more information, see Managed rotation in the Secrets Manager User Guide .
rotation_rules No A structure that defines the rotation configuration for this secret. When changing an existing rotation schedule and setting RotateImmediately to false : If using AutomaticallyAfterDays or a ScheduleExpression with rate() , the previously scheduled rotation might still occur. To prevent unintended rotations, use a ScheduleExpression with cron() for granular control over rotation windows.
external_secret_rotation_metadata No The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner. For more information about the required information, see Using Secrets Manager managed external secrets
external_secret_rotation_role_arn No The Amazon Resource Name (ARN) of the role that allows Secrets Manager to rotate a secret held by a third-party partner. For more information, see Security and permissions .
rotate_immediately No Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. The rotation schedule is defined in RotateSecretRequest$RotationRules . The default for RotateImmediately is true . If you don't specify this value, Secrets Manager rotates the secret immediately. If you set RotateImmediately to false , Secrets Manager tests the rotation configuration by...

Output

RotateSecretOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
arn str | None Always present —
name str | None Always present —
version_id str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

ExternalSecretRotationMetadataItem, RotateSecretOutput, RotationRulesType

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_secrets_manager.exceptions:

InternalServiceError, InvalidParameterError, InvalidRequestError, ResourceNotFoundError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model