SecretRotationEventSource
Source:
src/AWS/Lambda/SecretRotationEventSource.ts
Lambda runtime implementation for
AWS.SecretsManager.onSecretRotation(...).
This layer does three things at deploy time:
- Grants
secretsmanager.amazonaws.compermission to invoke the current function (scoped to this account viaaws:SourceAccount). - Attaches the rotation-protocol IAM actions for the bound secret
(
DescribeSecret,GetSecretValue,PutSecretValue,UpdateSecretVersionStageon the secret +GetRandomPassword). - Provisions the
RotationScheduleconfiguring the secret’s rotation to invoke this function — threaded through the Permission so Secrets Manager’s invoke-permission validation passes.
At runtime it narrows incoming invocations to rotation events for the bound secret and forwards them to the supplied handler.
Rotating Secrets
Section titled “Rotating Secrets”yield* SecretsManager.onSecretRotation( secret, { rotationRules: { automaticallyAfter: "30 days" } }, (event) => rotate(event).pipe(Effect.orDie),);