A developer is managing a production database infrastructure stack using AWS CloudFormation. The template defines an Amazon RDS DB instance whose master password must be rotated automatically every 15 days. Additionally, a manual modification to the DB instance's security group settings made via the AWS Console has caused a subsequent CloudFormation stack update to fail, leaving the stack stuck in the UPDATE_ROLLBACK_FAILED state.
How should the developer securely reference the rotated password in the template and resolve the stack update failure?
- Store the password in AWS Secrets Manager and reference it using a dynamic reference in the template. To resolve the UPDATE_ROLLBACK_FAILED state, run the ContinueUpdateRollback action, manually correcting the out-of-band security group changes if necessary to match the expected state.Answer
- BStore the password in Systems Manager Parameter Store as a SecureString parameter and reference it using a dynamic reference. To resolve the UPDATE_ROLLBACK_FAILED state, force a stack update by running UpdateStack with a modified template that excludes the drifted security group resource.
- CStore the password in AWS Secrets Manager and reference it using a dynamic reference in the template. To resolve the UPDATE_ROLLBACK_FAILED state, execute drift detection and use the auto-revert feature to automatically sync the manual configuration changes back to the CloudFormation template.
- DStore the password in Systems Manager Parameter Store as a SecureString parameter. To resolve the UPDATE_ROLLBACK_FAILED state, delete the stack to clean up the failed resources and redeploy the template with the updated security group configurations.
Answer
Store the password in AWS Secrets Manager and reference it using a dynamic reference in the template. To resolve the UPDATE_ROLLBACK_FAILED state, run the ContinueUpdateRollback action, manually correcting the out-of-band security group changes if necessary to match the expected state.
AWS Secrets Manager is the correct service for credentials that require automatic rotation. By referencing the secret via a dynamic reference in the template, CloudFormation retrieves the rotated credential securely. If an update fails and the rollback gets blocked (UPDATE_ROLLBACK_FAILED state), standard update actions are unavailable. The developer must invoke ContinueUpdateRollback to resume the rollback, manually aligning the out-of-band changes with the expected state to allow the rollback to finish.
Step-by-Step Solution
Key Concept
Managing Secrets Manager dynamic references with auto-rotation, and troubleshooting CloudFormation rollback failures caused by drift.