DOP-C02 Question 110
Single answerYour organization has implemented a CI/CD pipeline using AWS CodePipeline that deploys a serverless application on AWS Lambda. As part of the deployment process, the pipeline provisions resources using AWS CloudFormation. Recently, the deployments have started failing intermittently due to a resource conflict in one of the stacks. What is the best approach to ensure the pipeline handles such conflicts gracefully and completes successfully?
- A
Enable the 'Retain' deletion policy for the conflicting resources in the CloudFormation template.
- B
Configure the CloudFormation action in CodePipeline to use the 'CREATE_UPDATE' change set type.
- C
Set the CloudFormation stack policy to protect the conflicting resources during updates.
- D
Configure the CloudFormation action in CodePipeline to automatically retry failed stack updates.
Show answer and explanation
Correct answer: C
Explanation
Resource conflicts in AWS CloudFormation can often occur due to unintentional updates to critical resources. By setting a stack policy, you can protect specific resources from being updated during a stack update operation. This ensures that the deployment continues smoothly without interference from resource conflicts. Other options either do not address the root cause of the issue or are not applicable in this scenario.
- A. Incorrect.
Enabling the 'Retain' deletion policy would retain the resource when the stack is deleted, but it does not address resource conflicts during stack updates.
- B. Incorrect.
Using the 'CREATE_UPDATE' change set type only allows you to preview changes before applying them, but it doesn’t resolve resource conflicts automatically.
- C. Correct.
Setting a stack policy for CloudFormation allows you to protect specific resources during stack updates, preventing conflicts from affecting the deployment process.
- D. Incorrect.
Automatically retrying failed stack updates is not a feature of CodePipeline, and manual intervention is usually required for such failures.