FND02-BP08 Audit and rotate credentials periodically
Audit and rotate credentials on a regular schedule to limit how long they can be used to access your resources. Use temporary credentials when possible, and rotate risky long-term credentials regularly.
Desired outcome:
-
You have implemented credential rotation to help reduce the risks associated with long-term credential usage.
-
You regularly audit and remediate non-compliance with credential rotation policies.
-
Your organization uses temporary credentials by default, with long-term credentials reserved as documented exceptions that have explicit justification.
-
You have identified and removed unused or unnecessary credentials through periodic audits, reducing the attack surface across your environment.
Common anti-patterns:
-
Not auditing credential use.
-
Using long-term credentials unnecessarily.
-
Using long-term credentials and not rotating them regularly.
Benefits of establishing this best practice:
-
Reduced window of exposure if credentials are disclosed, through regular credential auditing and rotation.
-
Lower risk of unauthorized access from disclosed credentials by preferring temporary credentials and rotating long-term credentials regularly.
-
Smaller surface area through periodic audits that identify unused or unnecessary credentials and remove them.
-
Stronger compliance posture in meeting security standards that mandate regular credential reviews and rotation policies.
-
Better visibility into credential usage patterns, so teams can detect anomalous behavior.
-
Lower operational overhead through automated credential management and rotation, which improves consistency and reduces human error in credential lifecycle management.
Level of risk exposed if this best practice is not established: High
Implementation guidance
Long-term credentials (IAM user access keys, passwords, and service account keys) accumulate over time and become difficult to inventory and control. When these credentials are disclosed, they give an unauthorized party persistent access until they are rotated or revoked. The longer a credential exists, the higher the probability it has been disclosed through a security incident, inadvertent disclosure, or insider threat.
Remove long-term credentials wherever possible by replacing them with temporary credentials that expire automatically. Temporary credentials reduce risk because they have a built-in expiration: even if disclosed, they become unusable after a short period. AWS provides multiple mechanisms for temporary credentials: IAM roles, IAM Identity Center, and IAM Roles Anywhere. Reserve long-term credentials as documented exceptions with explicit justification, and review the alternatives to long-term access keys before accepting the risk of persistent credentials.
When long-term credentials cannot be removed (for legacy applications, third-party integrations, or on-premises systems that lack support for temporary credentials), rotate them regularly and audit them continuously. Rotation limits the window of exposure: if a credential is disclosed without your knowledge, rotation makes sure that it becomes invalid within a defined period (typically 90 days or less). Auditing reveals usage patterns, identifies credentials no longer needed, and detects anomalous behavior that might indicate unauthorized use. Long-term credential audits also verify that defined controls (source IP address restrictions, MFA requirements, and organization ID conditions) remain enforced over time.
Use automated tooling to validate that credential controls remain enforced. For human identities, rotate passwords and replace access keys with temporary credentials to narrow the window of exposure when credentials are disclosed. As organizations move from IAM users to centralized identities, use a credential report to audit remaining IAM users. Enforce and monitor MFA in the identity provider, and use AWS Config Rules or AWS Security Hub CSPM IAM controls to catch users who fail to configure MFA even when policy requires it.
The most common failure mode is credential sprawl: long-term credentials created for specific purposes but never retired when those purposes end. Developers leave the organization, temporary projects become permanent, and credentials accumulate in CI/CD systems, configuration files, and local machines. Without systematic auditing, these orphaned credentials remain active indefinitely. Another pitfall is completing rotation on schedule but failing to verify that old credentials are invalidated and that dependent systems have updated to the new credentials.
For machine identities, use IAM Roles Anywhere instead of long-term access keys. With X.509 certificates issued by a trusted certificate authority, on-premises servers and workloads outside AWS can obtain temporary credentials without storing long-term secrets. You then manage certificate lifecycle instead of static access keys, using mature PKI tooling and processes. Use AWS Secrets Manager to rotate database credentials, API keys, and other secrets without manual intervention. Configure alerts on rotation failures so that operations teams can intervene before credentials exceed policy thresholds.
Implementation steps
-
Regularly audit credentials: Audit the identities configured in your identity provider and AWS IAM
to verify that only authorized identities have access to your workload. Remove people that leave the organization, and remove cross-account roles no longer required. Have a process to periodically audit permissions to the services accessed by an IAM entity to identify policies that need modification to remove unused permissions. Use credential reports and AWS IAM Access Analyzer to audit IAM credentials and permissions. Use Amazon CloudWatch to set up alarms for specific API calls and Amazon GuardDuty to alert on unexpected activity that might indicate overly permissive access or unintended access to credentials. -
Evaluate long-term credentials for migration to temporary credentials: As part of each audit cycle, evaluate whether existing long-term credentials can be replaced with temporary credentials. Long-term credentials are often introduced for legacy applications or third-party integrations that did not support temporary credentials at initial setup. As these systems are updated or replaced, they might gain support for IAM roles, IAM Roles Anywhere, or other temporary credential mechanisms. Establish a regular review cadence (for example, quarterly) to reassess each long-term credential and migrate to short-term credentials where possible.
-
Rotate credentials regularly: When you are unable to use temporary credentials, rotate long-term IAM access keys regularly (maximum every 90 days). If an access key is unintentionally disclosed without your knowledge, this limits how long the credentials can be used. For information about rotating access keys for IAM users, see Update access keys.
-
Verify that defined controls are enforced: Use automated tooling to continuously validate that credential hygiene controls remain in place. A one-time configuration is not enough. Deploy AWS Config managed rules such as iam-user-mfa-enabled and access-keys-rotated to flag non-compliant resources. Enable the relevant AWS Security Hub CSPM controls for AWS Identity and Access Management to aggregate findings across accounts. Verify that supplementary controls such as source IP restrictions, MFA requirements, and aws:PrincipalOrgID conditions on long-term credentials remain enforced over time.
-
Automate credential rotation: Use AWS Secrets Manager to automate rotation of database credentials, API keys, and other secrets so that rotation occurs on a defined schedule without manual intervention. Configure alerts on rotation failures so that operations teams can intervene before credentials exceed policy thresholds.
-
Use IAM Roles Anywhere for machine identities: Use AWS IAM Roles Anywhere to provide temporary credentials for machine identities in areas where you traditionally could not use IAM roles, such as on-premises servers. AWS IAM Roles Anywhere uses a trusted X.509 certificate to authenticate to AWS and receive temporary credentials, removing the need to store long-term credentials in your on-premises environment. Monitor and rotate the X.509 certificate as it approaches expiration.
Resources
Related best practices:
Related documents:
Related videos: