Interview Prep/AWS/CloudFormation, CloudWatch, KMS, Secrets and Cost

`ResourceNotFoundException: Secrets Manager can't find the specified secret.` but the secret is in the console.

BeginnerTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer

Likely causes → The call goes to the wrong Region or account. Or the code uses a partial ARN: Secrets Manager adds a random 6-character suffix to ARNs, so arn:...:secret:prod/db without the suffix fails, while the name prod/db works. The secret may also be scheduled for deletion.

Diagnose →

aws secretsmanager describe-secret --secret-id prod/db --region us-east-1 --query '[ARN,DeletedDate]'
aws secretsmanager list-secrets --filters Key=name,Values=prod/ --region us-east-1 --query 'SecretList[].Name'

Fix →

  1. Reference the secret by name, or by full ARN including the suffix
  2. Set the Region explicitly
  3. If the secret is pending deletion: aws secretsmanager restore-secret --secret-id prod/db

Prevent → Pass secret ARNs from IaC outputs, and in IAM policies use secret:prod/db-?????? to match the suffix.

aws All AWS questions Roadmap: Cloud cost & architecture

More on CloudFormation, CloudWatch, KMS, Secrets and Cost