An application deployed via an AWS CloudFormation stack requires a database password that must be rotated automatically every 30 days. Additionally, operators occasionally make direct manual changes to the security group rules associated with the stack, which causes drift between the physical resources and the template definition. Which two actions should the developer take to manage these requirements?
- Store the password in AWS Secrets Manager, enable automatic rotation, and reference the password in the CloudFormation template using a dynamic reference.Answer
- Use AWS CloudFormation drift detection to identify manual modifications, and then update the template or resource properties to align with the actual state.Answer
- CStore the password in AWS Systems Manager Parameter Store as a SecureString parameter, and configure automatic rotation directly in the Parameter Store console.
- DPerform the stack update with the AWS CLI using the --ignore-drift parameter to allow CloudFormation to overwrite any manual resource modifications.
- ERun the AWS CLI command aws cloudformation rollback-stack when a stack update fails to automatically overwrite the out-of-band changes.
Answer
To securely manage the password and handle out-of-band configuration changes, the developer should store the password in AWS Secrets Manager with automatic rotation enabled and reference it in the CloudFormation template using dynamic references. In addition, the developer should use AWS CloudFormation drift detection to identify manual modifications and update the template or resource properties to align them.
The correct approach involves using AWS Secrets Manager to store the database password with automatic rotation and reference it securely in CloudFormation using dynamic references. Additionally, using CloudFormation drift detection helps developers identify out-of-band modifications to resources and synchronize the stack configuration, avoiding deployment failures.
Step-by-Step Solution
Key Concept
AWS CloudFormation Drift Detection and AWS Secrets Manager Dynamic References