A developer is troubleshooting a CI/CD pipeline in AWS CodePipeline that deploys infrastructure using AWS CloudFormation. During the initial deployment of a new stack, the deployment stage failed due to an invalid parameter value, leaving the CloudFormation stack in the ROLLBACK_COMPLETE state. After correcting the parameter value in the template and pushing the fix to the source repository, the pipeline runs again but the CloudFormation deploy stage fails immediately, indicating that the stack cannot be updated. Which action must the developer perform to successfully deploy the stack through the pipeline?
- Delete the existing CloudFormation stack manually or via the AWS CLI, and then trigger the pipeline again.Cevap
- BExecute the aws cloudformation continue-update-rollback CLI command to force the stack back to an active state, then trigger the pipeline.
- CModify the trust policy of the CloudFormation execution role to allow the cloudformation.amazonaws.com service principal to assume the role, and then release the change.
- DRun drift detection on the stack to identify manually modified resources, resolve the drift, and trigger the pipeline.
Cevap
Delete the existing CloudFormation stack manually or via the AWS CLI, and then trigger the pipeline again.
The correct answer is to delete the existing CloudFormation stack manually or via the AWS CLI, and then trigger the pipeline again. When a CloudFormation stack fails during its initial creation, it goes into the ROLLBACK_COMPLETE state. CloudFormation does not allow updates to a stack that has never been successfully created. Therefore, to proceed, the developer must delete the failed stack, which removes it, allowing the pipeline's subsequent run to perform a successful create operation.
Adım Adım Çözüm
Anahtar Kavram
Handling CloudFormation initial creation failures and the ROLLBACK_COMPLETE state in CI/CD pipelines.