`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 →
- Reference the secret by name, or by full ARN including the suffix
- Set the Region explicitly
- 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.
More on CloudFormation, CloudWatch, KMS, Secrets and Cost
Updating a stack fails: `Stack:arn:aws:cloudformation:...:stack/app/... is in ROLLBACK_COMPLETE state and can not be updated.`BeginnerA stack is stuck in `UPDATE_ROLLBACK_FAILED`.AdvancedA pipeline fails with `An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.`Beginner`InsufficientCapabilitiesException: Requires capabilities : [CAPABILITY_NAMED_IAM]`.BeginnerStack deletion ends in `DELETE_FAILED` with `The bucket you tried to delete is not empty` on an S3 bucket resource.IntermediateDrift detection shows `MODIFIED` on a security group and an RDS instance that someone changed in the console. How do you reconcile?Advanced