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 498 discussion

Accompany runs an application on Amazon EC2 and AWS Lambda. The application stores temporary data in Amazon S3. The S3 objects are deleted after 24 hours.

The company deploys new versions of the application by launching AWS CloudFormation stacks. The stacks create the required resources. After validating a new version, the company deletes the old stack. The deletion of an old development stack recently failed. A solutions architect needs to resolve this issue without major architecture changes.

Which solution will meet these requirements?

  • A. Create a Lambda function to delete objects from an S3 bucket. Add the Lambda function as a custom resource in the CloudFormation stack with a DependsOn attribute that points to the S3 bucket resource.
  • B. Modify the CloudFormation stack to attach a DeletionPolicy attribute with a value of Delete to the S3 bucket.
  • C. Update the CloudFormation stack to add a DeletionPolicy attribute with a value of Snapshot for the S3 bucket resource
  • D. Update the CloudFormation template to create an Amazon Elastic File System (Amazon EFS) file system to store temporary files instead of Amazon S3. Configure the Lambda functions to run in the same VPC as the EFS file system.
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
AzureDP900
1 week, 1 day ago
A is right By creating a Lambda function that deletes objects from the S3 bucket, you can ensure that the old CloudFormation stack is deleted even if the deletion process fails. Attaching this Lambda function as a custom resource in the CloudFormation stack allows CloudFormation to wait for the delete operation to complete before proceeding with the deletion of the old stack. The DependsOn attribute ensures that the Lambda function runs after the S3 bucket has been deleted, preventing any potential issues with deleting objects that may not be removed yet. Attaching this custom resource solves the issue without requiring major architecture changes.
upvoted 1 times
...
JoeTromundo
1 month, 2 weeks ago
Selected Answer: A
By using a Lambda function as a custom resource, you can ensure that the Lambda function deletes the objects in the S3 bucket before CloudFormation attempts to delete the bucket itself. Adding the DependsOn attribute ensures that the S3 bucket resource will not be deleted until the Lambda function has completed its task of clearing out all objects from the bucket, thus avoiding any errors caused by attempting to delete a non-empty S3 bucket. Options B and C: These options will not work because the DeletionPolicy attribute does NOT trigger the deletion of the OBJECTS INSIDE THE BUCKET. It ONLY determines what happens to the BUCKET RESOURCE ITSELF, not its contents. The stack deletion will still fail if objects remain in the bucket. Option D introduces significant architectural changes, which are unnecessary for solving the stack deletion issue.
upvoted 2 times
...
gfhbox0083
4 months, 2 weeks ago
Selected Answer: A
A, for sure. DeletionPolicy: Delete: The DeletionPolicy attribute in CloudFormation is used to specify what should happen to a resource when the stack is deleted. The value Delete indicates that CloudFormation should delete the resource (in this case, the S3 bucket) when the stack is deleted. Non-Empty Buckets: The problem with this approach is that CloudFormation cannot delete an S3 bucket if it contains any objects. The DeletionPolicy: Delete does not change this behavior; it only specifies that the bucket should be deleted, which will still fail if the bucket is not empty.
upvoted 4 times
...
gfhbox0083
4 months, 3 weeks ago
A, for sure. DeletionPolicy: Delete: The DeletionPolicy attribute in CloudFormation is used to specify what should happen to a resource when the stack is deleted. The value Delete indicates that CloudFormation should delete the resource (in this case, the S3 bucket) when the stack is deleted. Non-Empty Buckets: The problem with this approach is that CloudFormation cannot delete an S3 bucket if it contains any objects. The DeletionPolicy: Delete does not change this behavior; it only specifies that the bucket should be deleted, which will still fail if the bucket is not empty.
upvoted 2 times
...
ahrentom
4 months, 3 weeks ago
Selected Answer: A
you can´t delete a S3 bucket with objects in it. So A is correct
upvoted 3 times
...
Russs99
4 months, 3 weeks ago
Selected Answer: B
By setting the Deletion Policy attribute to Delete in the stack, you ensure that the S3 bucket and its contents are deleted when the CloudFormation stack is deleted. This best option for the scenario and and aligns with the desired behavior of removing old resources when the stack is deleted.
upvoted 1 times
...
Alagong
4 months, 3 weeks ago
Selected Answer: A
IT SHOULD BE A
upvoted 3 times
...
AhmedSalem
4 months, 3 weeks ago
Selected Answer: A
I will go for A. Using Lambda function as a custom resource ensures that the S3 bucket is emptied before the stack is deleted. DependsOn Attribute ensures the Lambda function runs and completes before attempting to delete the S3 bucket, thus preventing deletion failure.
upvoted 4 times
...
grandcanyon
4 months, 3 weeks ago
Selected Answer: B
When you specify a DeletionPolicy attribute with a value of Delete for an S3 bucket in a CloudFormation template, CloudFormation will delete the bucket and all its contents during stack deletion. This approach addresses the issue of the stack deletion failing due to the bucket not being empty.
upvoted 1 times
...
Helpnosense
4 months, 4 weeks ago
Selected Answer: C
Votes C. After s3 snapshot, cloud formation will proceed s3 bucket deletion. A is right but compare to c it doesn't match the requirement in the question. "resolve this issue without major architecture changes." Also the data become useless only after 24 hours. A delete everything regardless. C is better.
upvoted 1 times
...
toma
4 months, 4 weeks ago
it should be A
upvoted 4 times
...
mifune
5 months ago
Selected Answer: A
"DependsOn" attribute ensures that the Lambda function will always be invoked before the S3 bucket is deleted in a CloudFormation. Answer A.
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 ...