nerdexam
Amazon

DOP-C02 · Question #56

An IT team has built an AWS CloudFormation template so others in the company can quickly and reliably deploy and terminate an application. The template creates an Amazon EC2 instance with a user data

The correct answer is B. Add a custom resource with an AWS Lambda function with the DependsOn attribute specifying. For Amazon S3 buckets, you must delete all objects in the bucket for deletion to succeed. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute- deletionpolicy.html

Submitted by klara.se· Mar 6, 2026Configuration Management & Infrastructure as Code

Question

An IT team has built an AWS CloudFormation template so others in the company can quickly and reliably deploy and terminate an application. The template creates an Amazon EC2 instance with a user data script to install the application and an Amazon S3 bucket that the application uses to serve static webpages while it is running. All resources should be removed when the CloudFormation stack is deleted. However, the team observes that CloudFormation reports an error during stack deletion, and the S3 bucket created by the stack is not deleted. How can the team resolve the error in the MOST efficient manner to ensure that all resources are deleted without errors?

Options

  • AAdd a DelelionPolicy attribute to the S3 bucket resource, with the value Delete forcing the bucket
  • BAdd a custom resource with an AWS Lambda function with the DependsOn attribute specifying
  • CIdentify the resource that was not deleted. Manually empty the S3 bucket and then delete it.
  • DReplace the EC2 and S3 bucket resources with a single AWS OpsWorks Stacks resource. Define

How the community answered

(57 responses)
  • A
    16% (9)
  • B
    74% (42)
  • C
    7% (4)
  • D
    4% (2)

Explanation

For Amazon S3 buckets, you must delete all objects in the bucket for deletion to succeed. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute- deletionpolicy.html

Topics

#CloudFormation#S3 bucket lifecycle#stack deletion#custom resources

Community Discussion

No community discussion yet for this question.

Full DOP-C02 Practice