Course contentsShow
← Cloud and Infrastructure
Lesson 2240 of 2,98948. Secrets ManagementFree lesson

AWS Secrets Manager Rotation

Configuring automatic rotation of secrets in AWS Secrets Manager using Lambda functions and rotation strategies.

AWS Secrets Manager Rotation

You'll learn how to configure automatic rotation of secrets in AWS Secrets Manager using Lambda functions and rotation strategies.

Why Rotate Secrets?

Think of secrets like passwords to your house. If you never change them, an old key copied months ago could still grant access. Automatic rotation ensures that even if a secret leaks, it becomes useless after the next rotation cycle.

How AWS Secrets Manager Rotation Works

AWS Secrets Manager uses Lambda functions to automatically rotate secrets on a schedule. When rotation triggers:

  1. Lambda is invoked with your secret ARN
  2. The function creates a new secret value (e.g., new database password)
  3. It updates the target system (database, API, etc.)
  4. It verifies the new secret works
  5. It finalizes the rotation by marking it current

Rotation Strategies

AWS supports two primary strategies:

Single-User Rotation: The same credentials are updated in place. The service briefly switches from old to new credentials. Simple but has a brief moment where old credentials might be cached.

Alternating-User Rotation: Two sets of credentials alternate. While one is active, the other is rotated. Zero downtime, but requires managing two users.

Configuration Elements

  • Rotation schedule: Days between rotations (e.g., every 30 days)
  • Lambda function: Either AWS-provided templates or custom code
  • Resource permissions: Lambda needs permission to access both Secrets Manager and your target system

You configure rotation through the Secrets Manager console or API, specifying your Lambda function ARN and rotation interval.

Key Takeaway: AWS Secrets Manager rotation automates credential updates using Lambda functions on a schedule, with strategies like single-user or alternating-user rotation to minimize downtime and reduce security risk.