A developer is managing a production web application deployed via an AWS CloudFormation stack. The stack includes an Amazon RDS database and an Amazon ECS service. The database credentials must be rotated automatically every 30 days. To troubleshoot an urgent connectivity issue, a system administrator manually modified the database security group rules and the database master password directly in the AWS Management Console. When the developer subsequently attempts to update the stack to deploy a new ECS task definition, the stack update fails.
Which two actions should the developer take to resolve the update failure and align the infrastructure with AWS security best practices? (Select TWO.)
- Run drift detection on the stack to identify the out-of-band changes, and update the CloudFormation template to match the current database security group configuration.Cevap
- Store the database credentials in AWS Secrets Manager, and reference them in the CloudFormation template using dynamic references to support automatic rotation.Cevap
- CStore the database credentials in Systems Manager Parameter Store as String parameters, and enable the native Parameter Store rotation schedule.
- DRevert the manual security group modifications using the AWS Management Console, and use the `cfn-init` helper script within the ECS container definition to dynamically retrieve the new credentials during container startup.
- EManually change the stack status to `ROLLBACK_COMPLETE` in the CloudFormation console to bypass the failed update, then proceed with the task definition deployment.
Cevap
Run drift detection on the stack to identify the out-of-band changes, update the CloudFormation template to match the current database security group configuration, store the database credentials in AWS Secrets Manager, and reference them in the template using dynamic references.
To resolve the CloudFormation update failure due to manual out-of-band modifications, the developer should run drift detection to identify the changes and update the template configuration to match the current physical state. To securely manage the database password and satisfy the rotation requirement, the developer should store the credentials in AWS Secrets Manager, which natively supports automatic rotation, and reference them in the CloudFormation template using dynamic references.
Adım Adım Çözüm
Anahtar Kavram
Handling resource drift and managing secrets securely in AWS CloudFormation.