Exam DOP-C02 All QuestionsBrowse all questions from this 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?

    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
tgv

---> B

trungtdOption: B

of course B

inturistOption: B

Agree B

siheomOption: B

Definitely B