nerdexam
Amazon

SAP-C02 · Question #760

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…

The correct answer is A. Create a Lambda function to delete objects from an S3 bucket. Add the Lambda function as 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.

Submitted by fernanda_arg· Mar 6, 2026Continuous Improvement for Existing Solutions

Question

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?

Options

  • ACreate a Lambda function to delete objects from an S3 bucket. Add the Lambda function as a
  • BModify the CloudFormation stack to attach a DeletionPolicy attribute with a value of Delete to the
  • CUpdate the CloudFormation stack to add a DeletionPolicy attribute with a value of Snapshot for
  • DUpdate the CloudFormation template to create an Amazon Elastic File System (Amazon EFS) file

How the community answered

(46 responses)
  • A
    74% (34)
  • B
    4% (2)
  • C
    7% (3)
  • D
    15% (7)

Explanation

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.

Community Discussion

No community discussion yet for this question.

Full SAP-C02 Practice