Review the Secrets Manager encryption key

Distinguish Secrets Manager default encryption from custom key-policy and cross-account requirements.

Description

Without KmsKeyId, Secrets Manager encrypts values with the AWS managed aws/secretsmanager key. Choose a customer managed key for cross-account reads or direct control of key policy and lifecycle.

Potential impact

Missing decryption permissions can prevent an application from retrieving a required secret.

Remediation

Set KmsKeyId to the customer managed key ARN. Limit secret reads and KMS decryption to the required callers through the secret and key policies, then verify the application can retrieve the value.

Examples

Both examples create empty secrets. Generate and store the actual values securely in a separate step.

Before

yaml
Resources:
  MySecret:
    Type: AWS::SecretsManager::Secret
    Properties:
      Description: secret description

After

yaml
Resources:
  MySecret:
    Type: AWS::SecretsManager::Secret
    Properties:
      Description: secret description
      KmsKeyId: !Ref SecretKeyArn

The second example selects SecretKeyArn to encrypt values stored later.

References