Q68 — AWS SAP-C02 Ch.2
Question 68 of 75 | ← Chapter 2
Q218. A company has an application that is deployed on Amazon EC2 instances behind an Application Load Balancer (ALB). The instances are part of an Auto Scaling group. The application has unpredictable workloads and frequently scales out and in. The company's development team wants to analyze application logs to find ways to improve the application's performance. However, the logs are no longer available after instances scale in Which solution will give the development team the ability to view the application logs after a scale-in event?
- A. Enable access logs for the ALB. Store the logs in an Amazon S3 bucket
- B. Configure the EC2 instances to publish logs to Amazon CloudWatch Logs by using the unified CloudWatch agent ✓
- C. Modify the Auto Scaling group to use a step scaling policy
- D. Instrument the application with AWS X-Ray tracing
Correct Answer: B. Configure the EC2 instances to publish logs to Amazon CloudWatch Logs by using the unified CloudWatch agent
Explanation
Option A suggests enabling access logs for the ALB and storing them in an Amazon S3 bucket, which can capture load balancer information but not application-specific logs. Option C suggests modifying the Auto Scaling group to use a step scaling policy, which adjusts the desired capacity of the group based on predefined thresholds but does not address the problem of lost logs. Option D suggests instrumenting the application with AWS X-Ray tracing, which can provide insights into application performance but is not specifically related to the issue of lost logs. Therefore, option B provides the most suitable solution by configuring the EC2 instances to publish logs to Amazon CloudWatch Logs using the unified CloudWatch agent. This approach ensures that application logs are centrally stored, even if the instances are scaled in or terminated. The development team can then analyze these logs to identify ways to improve application performance.