SAP-C02 第 14 题
题目
A company is running an application on several Amazon EC2 instances in an Auto Scaling group behind an Application Load Balancer. The load on the application varies throughout the day, and EC2 instances are scaled in and out on a regular basis. Log files from the EC2 instances are copied to a central Amazon S3 bucket every 15 minutes. The security team discovers that log files are missing from some of the terminated EC2 instances. Which set of actions will ensure that log files are copied to the central S3 bucket from the terminated EC2 instances?
中文翻译:
一家公司正在应用程序负载均衡器后面的 Auto Scaling 组中的多个 Amazon EC2 实例上运行应用程序。应用程序的负载全天都在变化,EC2 实例会定期扩展和缩减。 EC2 实例中的日志文件每 15 分钟复制一次到中央 Amazon S3 存储桶。安全团队发现某些已终止的 EC2 实例缺少日志文件。哪组操作将确保日志文件从已终止的 EC2 实例复制到中央 S3 存储桶?
选项
A. Create a script to copy log files to Amazon S3, and store the script in a file on the EC2 instance. Create an Auto Scaling lifecycle hook and an Amazon EventBridge rule to detect lifecycle events from the Auto Scaling group. Invoke an AWS Lambda function on the autoscaling:EC2_INSTANCE_TERMINATING transition to send ABANDON to the Auto Scaling group to prevent termination, run the script to copy the log files, and terminate the instance using the AWS SDK.
中文翻译:
创建一个脚本以将日志文件复制到 Amazon S3,并将该脚本存储在 EC2 实例上的文件中。创建 Auto Scaling 生命周期挂钩和 Amazon EventBridge 规则以检测来自 Auto Scaling 组的生命周期事件。在 autoscaling:EC2_INSTANCE_TERMINATING 转换上调用 AWS Lambda 函数以将 ABANDON 发送到 Auto Scaling 组以防止终止,运行脚本以复制日志文件,并使用 AWS 开发工具包终止实例。
B. Create an AWS Systems Manager document with a script to copy log files to Amazon S3. Create an Auto Scaling lifecycle hook and an Amazon EventBridge rule to detect lifecycle events from the Auto Scaling group. Invoke an AWS Lambda function on the autoscaling:EC2_INSTANCE_TERMINATING transition to call the AWS Systems Manager API SendCommand operation to run the document to copy the log files and send CONTINUE to the Auto Scaling group to terminate the instance.
中文翻译:
使用脚本创建 AWS Systems Manager 文档以将日志文件复制到 Amazon S3。创建 Auto Scaling 生命周期挂钩和 Amazon EventBridge 规则以检测来自 Auto Scaling 组的生命周期事件。在 autoscaling:EC2_INSTANCE_TERMINATING 转换上调用 AWS Lambda 函数,以调用 AWS Systems Manager API SendCommand 操作来运行文档以复制日志文件并将 CONTINUE 发送到 Auto Scaling 组以终止实例。
C. Change the log delivery rate to every 5 minutes. Create a script to copy log files to Amazon S3, and add the script to EC2 instance user data. Create an Amazon EventBridge rule to detect EC2 instance termination. Invoke an AWS Lambda function from the EventBridge rule that uses the AWS CLI to run the user-data script to copy the log files and terminate the instance.
中文翻译:
将日志传送速率更改为每 5 分钟一次。创建一个脚本以将日志文件复制到 Amazon S3,并将该脚本添加到 EC2 实例用户数据。创建 Amazon EventBridge 规则来检测 EC2 实例终止。从 EventBridge 规则调用 AWS Lambda 函数,该函数使用 AWS CLI 运行用户数据脚本来复制日志文件并终止实例。
D. Create an AWS Systems Manager document with a script to copy log files to Amazon S3. Create an Auto Scaling lifecycle hook that publishes a message to an Amazon Simple Notification Service (Amazon SNS) topic. From the SNS notification, call the AWS Systems Manager API SendCommand operation to run the document to copy the log files and send ABANDON to the Auto Scaling group to terminate the instance.
中文翻译:
使用脚本创建 AWS Systems Manager 文档以将日志文件复制到 Amazon S3。创建一个 Auto Scaling 生命周期挂钩,将消息发布到 Amazon Simple Notification Service (Amazon SNS) 主题。从 SNS 通知中,调用 AWS Systems Manager API SendCommand 操作来运行文档以复制日志文件并将 ABANDON 发送到 Auto Scaling 组以终止实例。
答案
B
解析
正确答案:B 解析: 本题应选择 B。 正确选项: B. 使用脚本创建 AWS Systems Manager 文档以将日志文件复制到 Amazon S3。创建 Auto Scaling 生命周期挂钩和 Amazon EventBridge 规则以检测来自 Auto Scaling 组的生命周期事件。在 autoscaling:EC2_INSTANCE_TERMINATING 转换上调用 AWS Lambda 函数,以调用 AWS Sy...