# Credential Rotation

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

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/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.

Practice exams covering Credential Rotation: [CLF-C02 AWS Certified Cloud Practitioner](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner), [SOA-C03 AWS Certified CloudOps Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate), [DEA-C01 AWS Certified Data Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate), [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [MLA-C02 (beta) AWS Certified Machine Learning Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate), [SCS-C03 AWS Certified Security - Specialty](https://blowstack.com/practice-exams/aws-certified-security-specialty), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Credential Rotation

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

1. **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.
2. **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.
3. **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.
4. **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.
5. **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.
6. **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](https://blowstack.com/tools/cloud-services-hub/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.
- **[AWS Systems Manager](https://blowstack.com/tools/cloud-services-hub/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.
- **[AWS Lambda](https://blowstack.com/tools/cloud-services-hub/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.
- **[AWS CloudTrail](https://blowstack.com/tools/cloud-services-hub/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.

## Credential Rotation exam questions

Real practice exam questions on Credential Rotation, with the correct answer and its explanation.

### Question 1 (CLF-C02)

**Question:**

An application retrieves a third-party payment API token from AWS Secrets Manager. During a security review, a team replaces the stored token with a randomly generated string. The application successfully retrieves the new value, but the payment provider rejects its requests. The original token still works with the provider. What should the team do to complete the credential replacement?

**Correct answer:** Obtain a replacement token from the payment provider, store it in Secrets Manager, verify that the application uses it successfully, and revoke the original token with the provider.

**Explanation:** Complete rotation requires a replacement credential that the authenticating system accepts, delivery to the application, verification, and invalidation of the old credential. Updating secret storage alone does not accomplish this.

### Question 2 (MLA-C02 (beta))

**Question:**

A company uses a third-party evaluation platform to invoke foundation models in Amazon Bedrock. The platform supports Bedrock bearer-token authentication but cannot sign requests with AWS Signature Version 4. It imports credentials from the company's secure integration once every 24 hours and cannot refresh them between imports. Evaluation requests run continuously.

Security policy requires replacing the platform's credential at each daily import and invalidating its predecessor after successful authentication with the replacement. The integration can provision credentials and update the platform without interrupting requests.

Which credential choice and replacement procedure meet these requirements?

**Correct answer:** Create a long-term Amazon Bedrock API key with sufficient validity to cover the next import. Securely import it, verify successful model invocation with it, and then revoke the previous API key.

**Explanation:** A long-term Bedrock API key supports bearer-token authentication and can remain valid throughout the 24-hour import interval. Keeping the previous key valid until the replacement is verified preserves availability. Revoking the previous key then completes rotation.

### Question 3 (SAP-C03)

**Question:**

A company is standardizing AWS CloudFormation templates for new Amazon RDS for PostgreSQL DB instances across its application accounts. Each database must have a unique, automatically generated master password that rotates every 7 days. The selected RDS configuration supports service-managed master credentials.

Security policy prohibits the deployment pipeline and the CloudFormation execution role from retrieving plaintext passwords. Passwords must not be supplied as stack parameters or resolved into resource properties by CloudFormation. Applications already support retrieving database credentials at runtime from a secret ARN. The templates must expose this ARN to the application configuration.

Which solution meets these requirements with the LEAST operational overhead?

**Correct answer:** Set ManageMasterUserPassword to true on the AWS::RDS::DBInstance resource and omit MasterUserPassword. Use Fn::GetAtt with MasterUserSecret.SecretArn to supply the RDS-managed secret ARN to applications. Use the default RDS-managed rotation schedule.

**Explanation:** RDS generates and manages the master password in Secrets Manager and rotates it every 7 days by default. CloudFormation does not need to retrieve or resolve the plaintext password. The MasterUserSecret.SecretArn attribute provides the nonsecret identifier that applications can use for authorized runtime retrieval, without custom password-generation or rotation automation.

### Question 4 (SOA-C03)

**Question:**

A company runs an application as an Amazon ECS service on AWS Fargate. The task definition injects a database password from AWS Secrets Manager into an environment variable by using a secret ARN without a version ID or staging label. The application reads the environment variable when its worker process starts.

After a scheduled password rotation completes successfully, existing tasks fail when opening new database connections. A newly launched task using the same task definition connects successfully. A CloudOps engineer must restore all service tasks to the current credential without reversing the rotation or changing how the application receives the password.

Which action should the engineer take?

**Correct answer:** Force a new deployment of the ECS service using the existing task definition so that replacement tasks retrieve the current secret value.

**Explanation:** ECS retrieves an injected secret when a container starts; it does not automatically update the environment of running containers after rotation. A forced deployment replaces the tasks, and the replacement containers receive the current secret value without requiring a task definition change.

### Question 5 (SCS-C03)

**Question:**

A company runs a payment-processing service on Amazon ECS with AWS Fargate. Each task receives a payment provider's API token through an environment variable populated from AWS Secrets Manager when the task starts. The task definition references the secret without specifying a version ID or staging label. Running tasks do not retrieve the secret again.

The payment provider permits two tokens to remain valid simultaneously and supports explicit token revocation. An automated rotation workflow creates a replacement token, stores and tests it, and moves AWSCURRENT to the replacement secret version. The previous token remains valid at the provider. No token is compromised.

The company requires rotation without authentication failures and revocation of the previous token within 1 hour after promotion. An ECS rolling deployment can replace and drain all existing tasks within 20 minutes while maintaining sufficient healthy capacity.

Which action should the security engineer add after the workflow promotes the replacement secret version?

**Correct answer:** Force a new ECS service deployment. Wait until all previous tasks have drained and stopped, and verify that replacement tasks successfully authenticate with the new token. Then revoke the previous token at the payment provider.

**Explanation:** ECS injects the secret value when a task starts; changing AWSCURRENT does not update running tasks' environment variables. A forced deployment starts replacement tasks with the new token. Keeping both tokens valid until the previous tasks have drained avoids authentication failures. Verifying replacement-task authentication before revoking the previous token completes rotation within the stated time limit.

### Question 6 (DEA-C01)

**Question:**

A long-running ingestion application retrieves a third-party API token from AWS Secrets Manager. At startup, the application saves the returned VersionId and specifies that VersionId for all subsequent token retrievals. An existing rotation workflow periodically creates a pending secret version, activates the replacement token at the API provider, and promotes the replacement version for application use. The provider then revokes the previous token. Pending versions must not be used before activation.

After each rotation, the application continues retrieving the revoked token and receives authentication failures. The application's IAM role already has the required secret retrieval permissions. Which change should a data engineer make so the application can recover automatically without using an unactivated token?

**Correct answer:** On an authentication failure, retrieve the secret with VersionStage set to AWSCURRENT and omit VersionId. Replace the cached token and retry the request once.

**Explanation:** AWSCURRENT identifies the version promoted for application use. Omitting VersionId avoids pinning retrieval to the original, immutable version. Refreshing the cached token after an authentication failure allows the application to recover after rotation without selecting a pending version.

### Question 7 (DOP-C02)

**Question:**

A company uses AWS Secrets Manager and a custom AWS Lambda rotation function to manage a third-party API credential. The API provider supports multiple simultaneously valid tokens and requires an explicit API call to revoke each token by its immutable token ID. Changing a secret in Secrets Manager does not revoke tokens at the provider.

Every 24 hours, the rotation function creates a token, tests it, and promotes its secret version to AWSCURRENT. Application instances retrieve AWSCURRENT and cache the credential for at most 36 hours. The API provider does not support automatic token expiration. Rotation currently succeeds, but a security review discovers that all previously issued tokens remain valid.

The company requires each replaced token to remain valid for 36 hours after its replacement is promoted and to be revoked within the following hour. Scheduled rotations must continue every 24 hours without application changes.

Which change should a DevOps engineer implement?

**Correct answer:** During each rotation, durably record the immutable token ID from the outgoing AWSCURRENT version and the replacement's promotion time. Schedule a retryable cleanup invocation for 36 hours after that promotion to revoke the recorded token ID at the provider, treating an already-revoked token as success.

**Explanation:** The recorded token ID identifies the exact credential being retired even after additional rotations move the staging labels. Revoking that token at the provider after its 36-hour grace period completes rotation without disrupting cached credentials. Durable scheduling and idempotent retries support reliable retirement within the required window.

### Question 8 (SAA-C03)

**Question:**

A security team discovers that an engineer accidentally committed an IAM user's access key ID and secret access key to a public repository. An on-premises reporting tool uses this key. The team removes the credentials from the repository, resets the IAM user's console password, and enables MFA for console sign-in. However, the security team confirms that requests signed with the exposed key still succeed.

The company must immediately prevent further use of the exposed credential and restore the reporting tool's access securely. A brief interruption to reporting is acceptable.

Which action should a solutions architect recommend?

**Correct answer:** Deactivate the exposed access key immediately. Create a replacement key, securely configure the reporting tool to use it, verify successful requests, and delete the exposed key.

**Explanation:** Deactivation immediately prevents the exposed key from authenticating new requests. Securely distributing and testing a replacement restores legitimate access, and deleting the exposed key completes its retirement. The permitted interruption allows containment to take priority over an overlapping migration.

## Practice Credential Rotation in a full exam

Questions on Credential Rotation in each practice exam, with every answer option and an explanation for each:

- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 10 questions
- [DEA-C01](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate): 9 questions
- [SCS-C03](https://blowstack.com/practice-exams/aws-certified-security-specialty): 8 questions
- [CLF-C02](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner): 5 questions
- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 5 questions
- [SOA-C03](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate): 4 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 3 questions
- [MLA-C02 (beta)](https://blowstack.com/practice-exams/aws-certified-machine-learning-engineer-associate): 1 question
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 1 question

## What is Credential Rotation

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.

## Learn Credential Rotation in lessons

10 short lessons on Credential Rotation in 8 certification courses.

- CLF-C02: Credential Rotation: replacing and retiring credentials (Premium), https://app.blowstack.com/lessons/credential-rotation-replacing-and-retiring-credentials-clf-c02
- MLA-C02 (beta): Credential Rotation: replacing persistent API credentials (Premium), https://app.blowstack.com/lessons/credential-rotation-replacing-persistent-api-credentials-mla-c02
- SAP-C03: Credential Rotation: lifecycle coordination in infrastructure as code (Premium), https://app.blowstack.com/lessons/credential-rotation-lifecycle-coordination-in-infrastructure-as-code-sap-c03
- SOA-C03: Credential Rotation: securely storing rotating secrets in AWS (Premium), https://app.blowstack.com/lessons/credential-rotation-securely-storing-rotating-secrets-in-aws-soa-c03
- SCS-C03: Credential Rotation and Temporary Credentials: replacement versus expiration (Premium), https://app.blowstack.com/lessons/credential-rotation-and-temporary-credentials-replacement-versus-expiration-scs-c03
- DEA-C01: Credential Rotation: coordinated password replacement (Premium), https://app.blowstack.com/lessons/credential-rotation-coordinated-password-replacement-dea-c01
