DOP-C02 Exam QuestionsBrowse all questions from this exam

DOP-C02 Exam - Question 235


A company has developed a static website hosted on an Amazon S3 bucket. The website is deployed using AWS CloudFormation. The CloudFormation template defines an S3 bucket and a custom resource that copies content into the bucket from a source location.

The company has decided that it needs to move the website to a new location, so the existing CloudFormation stack must be deleted and re-created. However, CloudFormation reports that the stack could not be deleted cleanly.

What is the MOST likely cause and how can the DevOps engineer mitigate this problem for this and future versions of the website?

Show Answer
Correct Answer: B

Deletion has failed because the S3 bucket is not empty. In AWS CloudFormation, an S3 bucket must be empty before it can be deleted. Therefore, the failure occurs if the custom resource has already copied content into the bucket. To mitigate this problem, the custom resource's AWS Lambda function code should be modified to recursively empty the bucket when the RequestType is Delete. This way, the bucket will be emptied when the CloudFormation stack is deleted, allowing the deletion process to complete successfully.

Discussion

4 comments
Sign in to comment
siheomOption: B
Jul 12, 2024

Definitely B

inturistOption: B
Jul 12, 2024

Agree B

trungtdOption: B
Jul 14, 2024

of course B

tgv
Jul 15, 2024

---> B