exam questions

Exam AWS Certified DevOps Engineer - Professional DOP-C02 All Questions

View all questions & answers for the AWS Certified DevOps Engineer - Professional DOP-C02 exam

Exam AWS Certified DevOps Engineer - Professional DOP-C02 topic 1 question 22 discussion

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?

  • A. Add a DelelionPolicy attribute to the S3 bucket resource, with the value Delete forcing the bucket to be removed when the stack is deleted.
  • B. Add a custom resource with an AWS Lambda function with the DependsOn attribute specifying the S3 bucket, and an IAM role. Write the Lambda function to delete all objects from the bucket when RequestType is Delete.
  • C. Identify the resource that was not deleted. Manually empty the S3 bucket and then delete it.
  • D. Replace the EC2 and S3 bucket resources with a single AWS OpsWorks Stacks resource. Define a custom recipe for the stack to create and delete the EC2 instance and the S3 bucket.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
thanhnv142
Highly Voted 9 months ago
B is correct: - Cant delete S3 so must check S3 - There are several DeletionPolition option in ACF: delete, retain, snapshot. For S3, even if there is delete flag, S3 can only be deleted if all objects are removed A: wrong - add delete flag to deleteionpolicy cant forcing deletion of S3 C: should not manually do the task D: should not swap to AWS opsworks
upvoted 7 times
...
n_d1
Highly Voted 1 year, 4 months ago
B. As per the AWS DeletionPolicy Options documentation it says, "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
upvoted 7 times
...
HarryLy
Most Recent 4 months, 2 weeks ago
Selected Answer: B
Cloudformation does not have any behavior to force delete not empty bucket, need to invoke a custom lambda function to delete it
upvoted 1 times
...
c3518fc
5 months, 2 weeks ago
Selected Answer: B
Keyword "Custom Resource"
upvoted 1 times
...
madperro
1 year, 4 months ago
Selected Answer: B
B is a correct answer. A is wrong, you can't delete a bucket that has any objects.
upvoted 1 times
...
haazybanj
1 year, 5 months ago
Selected Answer: B
B. Add a custom resource with an AWS Lambda function with the DependsOn attribute specifying the S3 bucket, and an IAM role. Write the Lambda function to delete all objects from the bucket when RequestType is Delete.
upvoted 2 times
...
alce2020
1 year, 6 months ago
B is the correct answer
upvoted 1 times
...
ele
1 year, 6 months ago
Selected Answer: B
Because it's B. CFN will not delete non-empty bucket. It must be emptied first. Custom resource will do it.
upvoted 3 times
...
lqpO_Oqpl
1 year, 6 months ago
Why not A?
upvoted 1 times
tycho
1 year, 6 months ago
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html deletion policy seems fine as well ...
upvoted 1 times
tallmantim
9 months, 1 week ago
As per the linked article: "For Amazon S3 buckets, you must delete all objects in the bucket for deletion to succeed."
upvoted 2 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago