A developer is writing an AWS CloudFormation template to deploy a web application. The application requires access to a database password that must be rotated automatically every 30 days.
Which approach should the developer use to reference this password in the CloudFormation template while meeting the security requirements?
- Retrieve the database password dynamically in the CloudFormation template using a dynamic reference to a secret stored in AWS Secrets Manager.Answer
- BRetrieve the database password in the template by referencing a standard parameter stored in AWS Systems Manager Parameter Store.
- CManually update the database password directly in the database instance and use CloudFormation drift detection to automatically synchronize the template with the new password.
- DUpdate the password parameter in the CloudFormation template during a stack update, and if the update fails, allow the stack to remain in the ROLLBACK_IN_PROGRESS state to re-attempt the password rotation.
Answer
Retrieve the database password dynamically in the CloudFormation template using a dynamic reference to a secret stored in AWS Secrets Manager.
The correct option is to retrieve the database password dynamically in the CloudFormation template using a dynamic reference to a secret stored in AWS Secrets Manager. Secrets Manager is designed specifically to handle sensitive information and provides built-in integration for automatic rotation of credentials. CloudFormation can securely fetch the current version of the secret during deployment using dynamic references.
Step-by-Step Solution
Key Concept
AWS CloudFormation Dynamic References with AWS Secrets Manager