QuestionQ34

VerifiedContinuous Improvement for Existing Solutions

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?

Explanation

CloudFormation cannot delete S3 buckets that contain objects. A Lambda function as a custom resource can programmatically empty the bucket before the stack deletion occurs. Using the DependsOn attribute ensures the Lambda function runs and completes before attempting to delete the S3 bucket resource, preventing deletion failures even though temporary data exists in the bucket at deletion time.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!