Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam AWS Certified Solutions Architect - Professional SAP-C02 All Questions

View all questions & answers for the AWS Certified Solutions Architect - Professional SAP-C02 exam

Exam AWS Certified Solutions Architect - Professional SAP-C02 topic 1 question 329 discussion

A financial services company runs a complex, multi-tier application on Amazon EC2 instances and AWS Lambda functions. The application stores temporary data in Amazon S3. The S3 objects are valid for only 45 minutes and are deleted after 24 hours.

The company deploys each version of the application by launching an AWS CloudFormation stack. The stack creates all resources that are required to run the application. When the company deploys and validates a new application version, the company deletes the CloudFormation stack of the old version.

The company recently tried to delete the CloudFormation stack of an old application version, but the operation failed. An analysis shows that CloudFormation failed to delete an existing S3 bucket. A solutions architect needs to resolve this issue without making major changes to the application's architecture.

Which solution meets these requirements?

  • A. Implement a Lambda function that deletes all files from a given S3 bucket. Integrate this Lambda function as a custom resource into the CloudFormation stack. Ensure that the custom resource has a DependsOn attribute that points to the S3 bucket's resource.
  • B. Modify the CloudFormation template to provision an Amazon Elastic File System (Amazon EFS) file system to store the temporary files there instead of in Amazon S3. Configure the Lambda functions to run in the same VPC as the file system. Mount the file system to the EC2 instances and Lambda functions.
  • C. Modify the CloudF ormation stack to create an S3 Lifecycle rule that expires all objects 45 minutes after creation. Add a DependsOn attribute that points to the S3 bucket’s resource.
  • D. Modify the CloudFormation stack to attach a DeletionPolicy attribute with a value of Delete to the S3 bucket.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
HunkyBunky
Highly Voted 1 year ago
Selected Answer: A
It should be A, becase with DeletionPolicy you can only keep or delete bucket, but bucket can't be deleted if it is not empty. So better way in that case - to create a lambda function as a custom resource, that will clean bucket before deletion. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html https://awstut.com/en/2022/05/08/create-and-delete-s3-object-by-cfn-custom-resource-en/
upvoted 17 times
...
dankositzke
Highly Voted 9 months, 1 week ago
Selected Answer: A
A because anyone who goes by the name of HunkyBunky must know what they are talking about
upvoted 6 times
...
AzureDP900
Most Recent 1 week ago
A is correct, This solution meets the requirements because it allows you to delete the S3 bucket when deleting the CloudFormation stack, which was failing due to the bucket not being deleted. By implementing a Lambda function as a custom resource, you can trigger it to delete the S3 bucket when the CloudFormation stack is deleted, ensuring that all resources are properly cleaned up.
upvoted 1 times
...
federikinho
8 months, 2 weeks ago
100% HunkyBunky explanation. You cannot just delete a non-empty bucket
upvoted 2 times
...
career360guru
10 months, 3 weeks ago
Selected Answer: A
Option A. Option C can be a good option but application itself deletes the objects after 24 hours so it will affect and will requires changes to application that is clearly stated in question as No.
upvoted 2 times
...
J0n102
11 months, 3 weeks ago
Selected Answer: A
Answer: A, I agree with @HunkyBunky's reasoning
upvoted 1 times
...
shaaam80
12 months ago
Selected Answer: A
Answer is A. S3 buckets can't be deleted if they are not empty. Create a Lambda function to empty the bucket so bucket can be deleted.
upvoted 3 times
...
salazar35
1 year ago
Selected Answer: A
Same as HunkyBunky comment
upvoted 2 times
...
devalenzuela86
1 year ago
Selected Answer: D
For sure D
upvoted 2 times
devalenzuela86
1 year ago
Change to A. Its better option than D
upvoted 1 times
sat2008
9 months, 1 week ago
D is not an option at all it will keep the S3 regardless empty or not and only delete the stack
upvoted 3 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 ...