A development team manages their application infrastructure using an AWS CloudFormation stack. A developer needs to update the stack to change the instance type of an Amazon EC2 instance. However, drift detection reveals that the security group attached to the EC2 instance was manually modified out-of-band in the AWS Management Console to allow traffic on port . In addition, the developer needs to reference a database password that must be automatically rotated.
Which combination of steps should the developer take to resolve the drift and retrieve the password securely and cost-effectively? (Select TWO.)
- Update the CloudFormation template to match the drifted security group configuration (allowing port ) before proceeding with the stack update.Answer
- Use a dynamic reference in the CloudFormation template to retrieve the database password from AWS Secrets Manager.Answer
- CPerform the stack update with the drift synchronization option enabled to automatically rewrite the CloudFormation template based on the live resource configuration.
- DUse a dynamic reference in the CloudFormation template to retrieve the database password from AWS Systems Manager Parameter Store.
- EInitiate a stack update rollback using the AWS Command Line Interface (AWS CLI) to revert the drifted security group rules to their template-defined values.
Answer
Update the CloudFormation template to match the drifted security group configuration before proceeding with the stack update, and use a dynamic reference in the CloudFormation template to retrieve the database password from AWS Secrets Manager.
To resolve the configuration drift where port was manually allowed, the developer must update the template to match this state before performing subsequent updates. Additionally, retrieving an automatically rotated database credential is best achieved by storing the credential in AWS Secrets Manager and accessing it using a dynamic reference in the template.
Step-by-Step Solution
Key Concept
CloudFormation drift resolution and dynamic references for rotated secrets