SAP-C02 第 329 题
题目
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?
中文翻译:
一家金融服务公司在 Amazon EC2 实例和 AWS Lambda 函数上运行复杂的多层应用程序。该应用程序将临时数据存储在 Amazon S3 中。 S3 对象的有效期仅为 45 分钟,24 小时后将被删除。该公司通过启动 AWS CloudFormation 堆栈来部署应用程序的每个版本。该堆栈创建运行应用程序所需的所有资源。当公司部署并验证新的应用程序版本时,公司会删除旧版本的 CloudFormation 堆栈。该公司最近尝试删除旧应用程序版本的CloudFormation堆栈,但操作失败。分析表明,CloudFormation 无法删除现有的 S3 存储桶。解决方案架构师需要在不对应用程序架构进行重大更改的情况下解决此问题。哪种解决方案满足这些要求?
选项
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.
中文翻译:
实现一个 Lambda 函数,用于删除给定 S3 存储桶中的所有文件。将此 Lambda 函数作为自定义资源集成到 CloudFormation 堆栈中。确保自定义资源具有指向 S3 存储桶资源的 DependsOn 属性。
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.
中文翻译:
修改 CloudFormation 模板以预置 Amazon Elastic File System (Amazon EFS) 文件系统,以将临时文件存储在其中而不是存储在 Amazon S3 中。将 Lambda 函数配置为在与文件系统相同的 VPC 中运行。将文件系统挂载到 EC2 实例和 Lambda 函数。
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.
中文翻译:
修改 CloudFormation 堆栈以创建一条 S3 生命周期规则,该规则使所有对象在创建 45 分钟后过期。添加指向 S3 存储桶资源的 DependsOn 属性。
D. Modify the CloudFormation stack to attach a DeletionPolicy attribute with a value of Delete to the S3 bucket.
中文翻译:
修改 CloudFormation 堆栈以将值为“Delete”的 DeletionPolicy 属性附加到 S3 存储桶。
答案
A
解析
正确答案:A 解析: 本题应选择 A。 正确选项: A. 实现一个 Lambda 函数,用于删除给定 S3 存储桶中的所有文件。将此 Lambda 函数作为自定义资源集成到 CloudFormation 堆栈中。确保自定义资源具有指向 S3 存储桶资源的 DependsOn 属性。 选择理由: 该选项最直接地满足题干中的关键约束。做 SAP-C02 题目时,需要同时对照题干里的限定词,例如最高性能、最低运维开销、成本效益、可靠性、可扩展...