
Answer-first summary for fast verification
Answer: Create an Amazon CloudWatch agent configuration for the workload. Store the CloudWatch agent configuration in an Amazon S3 bucket. Write an EC2 user data script to fetch the configuration file from Amazon S3. Configure the CloudWatch agent on the instance during initial boot.
1. Explanation for the answer A: Option A is correct because it effectively addresses the requirement to have the CloudWatch Logs agent installed and configured on all new EC2 instances launched by the Auto Scaling group. Here's a detailed breakdown: - **Amazon CloudWatch Agent Configuration**: Setting up a specific configuration for monitoring and logging with the CloudWatch agent ensures that the needed logs are collected correctly according to the application requirements. - **Storing in Amazon S3**: Storing the CloudWatch agent configuration in an Amazon S3 bucket allows easy and centralized access to the configuration file, making it readily accessible to any new instance created by the Auto Scaling group. - **EC2 User Data Script**: Using EC2 user data scripts is a common method to run commands during the boot process of an instance. In this case, the script will fetch the CloudWatch agent configuration file from Amazon S3 and then configure and start the CloudWatch agent on the instance. - **Initial Bootstrap Configuration**: This ensures all new instances get the CloudWatch configuration during their initial boot without manual intervention, making the setup consistent and automated. By leveraging these approaches, you ensure that as new instances get created by the Auto Scaling group, they automatically start sending logs to CloudWatch Logs, fulfilling the requirement seamlessly.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
Amazon EC2 instances are used by a business to execute applications. The organization intends to use an Auto Scaling group to manage the instances. A solutions architect must ensure that Amazon CloudWatch Logs gathers logs from all new instances as part of this transition. The new Auto Scaling group will begin with an Amazon Linux 2 AMI and no key pair. Which solution satisfies these criteria?
A
Create an Amazon CloudWatch agent configuration for the workload. Store the CloudWatch agent configuration in an Amazon S3 bucket. Write an EC2 user data script to fetch the configuration file from Amazon S3. Configure the CloudWatch agent on the instance during initial boot.
B
Create an Amazon CloudWatch agent configuration for the workload in AWS Systems Manager Parameter Store. Create a Systems Manager document that installs and configures the CloudWatch agent by using the configuration. Create an Amazon EventBridge (Amazon CloudWatch Events) rule on the default event bus with a Systems Manager Run Command target that runs the document whenever an instance enters the running state.
C
Create an Amazon CloudWatch agent configuration for the workload. Create an AWS Lambda function to install and configure the CloudWatch agent by using AWS Systems Manager Session Manager. Include the agent configuration inside the Lambda package. Create an AWS Config custom rule to identify changes to the EC2 instances and invoke Lambda function.
D
Create an Amazon CloudWatch agent configuration for the workload. Save the CloudWatch agent configuration as part of an AWS Lambda deployment package. Use AWS CloudTrail to capture EC2 tagging events and initiate agent installation. Use AWS CodeBuild to configure the CloudWatch agent on the instances that run the workload.