exam questions

Exam AWS DevOps Engineer Professional All Questions

View all questions & answers for the AWS DevOps Engineer Professional exam

Exam AWS DevOps Engineer Professional topic 1 question 125 discussion

Exam question from Amazon's AWS DevOps Engineer Professional
Question #: 125
Topic #: 1
[All AWS DevOps Engineer Professional Questions]

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 DeletionPolicy 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. From the S3 console, 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
easytoo
2 years, 4 months ago
I'm going for A: Option A uses the built-in CloudFormation functionality of DeletionPolicy to ensure that the S3 bucket is removed when the CloudFormation stack is deleted. This is a simple and well-documented feature that is widely used in CloudFormation templates.
upvoted 2 times
Lalo
1 year, 10 months ago
Correct IS BBBBBB: 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 1 times
...
...
Bulti
2 years, 6 months ago
Selected Answer: B
B is the right answer.
upvoted 1 times
...
saggy4
2 years, 7 months ago
Selected Answer: B
The Correct Option is B
upvoted 2 times
...
Imstack
2 years, 7 months ago
BBBBBBBBB
upvoted 2 times
...
SuriSagar
2 years, 7 months ago
It's B. You can create a lambda function to clean up your bucket and invoke your lambda from your CloudFormation stack using a CustomResource.
upvoted 1 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 ...