
Ultimate access to all questions.
A financial services company operates a multi-tier application using Amazon EC2 instances and AWS Lambda functions. This application temporarily stores data in Amazon S3, where the data validity is limited to 45 minutes and is automatically deleted after 24 hours. The company utilizes AWS CloudFormation to deploy each application version, creating all necessary resources through the stack. Upon deploying and validating a new version, the previous version's CloudFormation stack is deleted. Recently, the deletion of an old stack failed due to CloudFormation being unable to remove an existing S3 bucket. A solutions architect must address this issue without significantly altering the application's architecture. What solution is most appropriate to resolve this issue?
A
Implement a Lambda function that clears all files from a specified S3 bucket. Incorporate this Lambda function as a custom resource within the CloudFormation stack, ensuring the custom resource includes a DependsOn attribute linked to the S3 bucket's resource.
B
Alter the CloudFormation template to include an Amazon Elastic File System (Amazon EFS) for temporary file storage instead of S3. Configure the Lambda functions to operate within the same VPC as the file system and mount this system to both EC2 instances and Lambda functions.
C
Adjust the CloudFormation stack to implement an S3 Lifecycle rule that automatically expires objects 45 minutes post-creation. Ensure this rule has a DependsOn attribute pointing to the S3 bucket's resource.
D
Update the CloudFormation stack to include a DeletionPolicy attribute set to Delete for the S3 bucket.