AWS Certified Solutions Architect – Professional
Secrets Manager multi-Region and cross-account access: SAP-C03
The Secrets Manager User Guide says a secret can be replicated to other Regions, and rotation on the primary propagates each new value to every replica. Reading a secret from another account needs a resource policy on the secret, an identity policy on the caller, and a KMS key that you create, because aws/secretsmanager cannot be used across accounts.
Replicating a secret to other Regions
Secrets Manager replicates the encrypted secret data and metadata, such as tags and resource policies, to the Regions you choose. The replica's ARN is the same as the primary's except for the Region. Each replica can be encrypted with a KMS key in its own Region. The target Region must be enabled first.
Rotation is configured on the primary only. Secrets Manager rotates the secret in the primary Region and the new value propagates to all replicas, so you do not manage rotation on each replica. A replica cannot be updated independently of its primary, except for its encryption key.
An application can read a secret from another Region without replication by calling the Secrets Manager endpoint in the Region where the secret is stored. AWS points to replication for Regional access, low latency and resilience, with applications reading the replica in their own Region.
Promoting a replica makes it a standalone secret. Changes to the primary no longer reach it. AWS gives two reasons to promote: disaster recovery when the primary becomes unavailable, and turning on rotation for that copy. StopReplicationToReplica is called in the replica's Region, and applications must then be updated to use the standalone secret.
Reading a secret from another account
Cross-account access must be allowed in two policies. A resource policy on the secret allows the role in the other account. An identity policy on that role allows secretsmanager:GetSecretValue on the secret and kms:Decrypt on the key. This differs from access within one account.
The key is the third part. The AWS managed key aws/secretsmanager cannot be used for cross-account access. The secret must be encrypted with a KMS key that you create, and that key's policy must allow the other account's role. Reading needs kms:Decrypt. A principal that also writes the secret value needs kms:GenerateDataKey.
AWS warns against granting secretsmanager:PutResourcePolicy in a resource policy, because it lets a principal, even one in another account, rewrite the policy. The BlockPublicPolicy parameter and IAM Access Analyzer help check what a resource policy allows.
Rotation types and RDS-managed master passwords
Secrets Manager has three forms of rotation. Managed rotation is configured and run by the service that owns the secret and uses no Lambda function. Managed external secrets rotation covers secrets held by Secrets Manager partners and also uses no Lambda function. Every other secret rotates through a Lambda function that updates both the secret and the database or service.
Amazon RDS can own the master user password. Setting ManageMasterUserPassword to true when creating or modifying a DB instance makes RDS generate the password, store it in Secrets Manager and rotate it every seven days by default. The rotation schedule can be changed.
The secret can use the default key or a customer managed key, but the key cannot be changed once RDS manages the credentials. Deleting the DB instance deletes the secret. The integration is not supported with RDS Custom or Blue/Green Deployments, and for most engines a read replica cannot be created from a source that manages its credentials this way.
Where the exam catches people
- Believing each replica secret needs its own rotation schedule: rotation runs on the primary and the new value propagates to every replica.
- Believing a replica can be edited or rotated separately while it is still a replica: only its encryption key can change. It must be promoted to a standalone secret first.
- Believing an identity policy with
kms:Decryptis enough to read another account's secret: the secret needs a resource policy and a KMS key you create, becauseaws/secretsmanagercannot be used across accounts. - Believing every rotation needs a Lambda function: managed rotation and managed external secrets rotation use none.
- Believing the KMS key of an RDS-managed master user secret can be swapped later: it cannot be changed once RDS manages the credentials.