Which solution will give the development team the ability to view the application logs after a scale-in event?
Enable access logs for the ALB. Store the logs in an Amazon S3 bucket.
Configure the EC2 instances to publish logs to Amazon CloudWatch Logs by using the unified CloudWatch agent.
Modify the Auto Scaling group to use a step scaling policy.
Instrument the application with AWS X-Ray tracing.
Explanations:
Enabling access logs for the ALB will provide logs related to request and response information for the load balancer itself, but it will not capture application-specific logs from the EC2 instances. Therefore, it won’t help the development team analyze application performance after instances scale in.
Configuring EC2 instances to publish logs to Amazon CloudWatch Logs ensures that application logs are sent to a centralized logging service. These logs will persist beyond the lifecycle of the EC2 instances, allowing the development team to analyze them even after instances scale in.
Modifying the Auto Scaling group to use a step scaling policy may optimize how instances are added or removed based on workload, but it does not address the issue of log persistence after instances scale in. This option does not provide a solution for analyzing logs post scale-in events.
Instrumenting the application with AWS X-Ray tracing allows for performance monitoring and debugging of applications but does not specifically solve the problem of log retention after EC2 instances scale in. X-Ray is more focused on tracing requests and performance bottlenecks rather than logging application output.