CLOUD CONCEPT

Credential Rotation

Credential rotation is the controlled replacement of authentication secrets, followed by retirement of the old credentials, to limit their useful lifetime.

Cloud Concepts Hub →

What is Credential Rotation

Passwords, access keys, tokens, and application secrets can be exposed through compromised systems, accidental disclosure, or excessive distribution. Rotation limits how long a persistent credential remains usable, but it must coordinate changes across the identity system, secret storage, and consuming applications to avoid outages.

Credential rotation replaces an authentication secret and retires its predecessor. A complete rotation changes the credential at the system that validates it, securely distributes the replacement to authorized consumers, verifies successful authentication, and invalidates the old value. Merely generating a new password or updating a secret in storage does not complete rotation if the target system still accepts the old credential.

In cloud environments, first distinguish long-lived credentials from temporary credentials. Long-lived credentials include IAM user access keys, database passwords, and many third-party API secrets. These require explicit lifecycle management. Temporary credentials have an expiration time and are obtained again when needed. For workloads accessing AWS, prefer IAM roles and temporary credentials over embedded IAM user access keys. Supported SDK credential providers can obtain and refresh role credentials without application code handling persistent secrets.

For an unavoidable IAM user access key, a practical rotation sequence is to create a second key, update authorized consumers, verify that requests use the replacement, deactivate the old key, and eventually delete it. An IAM user can have at most two access keys, including inactive keys, so available key slots affect the procedure. Access keys do not automatically expire because of an IAM password policy. Password policies govern IAM user console passwords, including configurable complexity, reuse prevention, and expiration settings; they do not rotate API credentials.

Database password rotation requires coordination between the database and its clients. For example, a rotation workflow can generate a new password, apply it to the database account, test access, and promote the new secret version for application retrieval. AWS Secrets Manager supports automatic rotation through managed integrations or Lambda-based workflows, depending on the secret and target service. Applications must refresh cached secrets appropriately and recover from authentication failures; otherwise, successful rotation can still interrupt connection establishment.

Secret storage and secret rotation are separate capabilities. A central store protects values, controls retrieval, and reduces hard-coded credentials in source repositories and deployment files. AWS Systems Manager Parameter Store can store encrypted SecureString parameters, but parameter expiration notifications or policies do not themselves change credentials in a database or external system. Rotation requires an integration or workflow that updates both the target and its stored value.

Choose rotation timing according to exposure risk, credential capabilities, compliance requirements, and operational constraints. Scheduled rotation can reduce the lifetime of an undiscovered leaked secret, but suspected compromise requires immediate containment rather than waiting for the next schedule. Replace or revoke affected credentials, investigate their use, and address the original exposure. Replacing a password or access key does not necessarily terminate sessions or invalidate temporary credentials already issued; those may need separate controls.

Availability and security can conflict during cutover. Brief overlap between old and new credentials can support a safe rollout when the target accepts both, but it also extends the old credential's usability. Single-password accounts may require carefully timed updates, retries, or an alternating-account strategy. Test failures, partial deployment, stale caches, and recovery procedures before production use. Restrict the rotation workflow's permissions, avoid logging secret values, and alert on failed or overdue rotations.

Finally, credential rotation is not the same as encryption-key rotation. Rotating an AWS KMS key's backing key material does not change database passwords, replace IAM access keys, or automatically re-encrypt existing data. Rotation also does not replace least privilege, multifactor authentication, secure storage, or incident response. For human passwords, arbitrary frequent changes are not a substitute for strong passwords and MFA; use applicable policy requirements and evidence of compromise to guide changes.

Key aspects of Credential Rotation

Effective rotation combines secure replacement, coordinated consumer updates, verification, and timely retirement while favoring temporary credentials wherever possible.

Complete lifecycle replacement

Generate a replacement, apply it to the authenticating system, update consumers, verify access, and retire the old credential. Updating only the stored secret leaves the rotation incomplete.

Preference for temporary credentials

Use roles, federation, and short-lived credentials where supported to reduce dependence on persistent secrets. Ensure applications use credential providers that refresh temporary credentials before they expire.

Coordinated application cutover

Account for secret caching, connection pools, deployment timing, and whether the target supports overlapping credentials. Keep any overlap bounded and verify adoption before retiring the old value.

Risk-based timing and emergency response

Set rotation schedules according to risk and applicable requirements. Immediately contain suspected credential compromise, including reviewing sessions and previously issued tokens where relevant.

Protected storage and limited access

Store credentials centrally with encryption and narrowly scoped retrieval permissions. Give rotation automation only the permissions it needs, and prevent secret values from entering logs.

Verification and operational visibility

Test the replacement against the target before completing the cutover. Monitor rotation failures, stale credentials, and unexpected use of retired identities or keys.

Cloud services for Credential Rotation

IAM roles and AWS STS reduce reliance on persistent AWS credentials by providing temporary access. For secrets that must persist, Secrets Manager stores values and coordinates supported rotation workflows, with Lambda implementing target-specific updates when required. Systems Manager Parameter Store can hold encrypted secrets, but storage and parameter notifications alone do not rotate credentials in the target system.

IAM permissions control which applications retrieve secrets and which automation can change them. Applications must refresh credentials and tolerate controlled cutovers. CloudTrail supplies an audit trail of supported management and access operations, while operational monitoring should detect failed rotations and authentication errors.

AWS Secrets Manager image AWS Secrets Manager

Stores secrets and supports automatic rotation through managed rotation for supported integrations or Lambda-based rotation workflows. Successful rotation must update the target system as well as the stored secret, and consumers must retrieve the current value.

Open AWS Secrets Manager →
AWS Systems Manager image AWS Systems Manager

Parameter Store provides centralized configuration and secret storage, including encrypted SecureString parameters. Parameter policies can support expiration and change notifications, but rotating a target credential requires separate automation or integration.

Open AWS Systems Manager →
AWS Lambda image AWS Lambda

Runs rotation logic for supported Secrets Manager workflows and custom credential-management automation. Functions need access to the target system and narrowly scoped permissions to generate, apply, test, and store replacement credentials.

Open AWS Lambda →
AWS CloudTrail image AWS CloudTrail

Records supported AWS API activity, including credential-management and secret-access operations, to support investigation and audit. Its records can help establish who changed credentials, when changes occurred, and whether unexpected access followed.

Open AWS CloudTrail →