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 would log incoming requests to the ALB, but not application-specific logs. The logs will not include details about the application’s internal performance, and they would not persist after instances scale in, as they are tied to the ALB, not the application itself.
Configuring EC2 instances to publish logs to CloudWatch Logs ensures that logs are stored independently of the EC2 instances. This allows the development team to retain and analyze logs even after instances scale in or terminate.
Modifying the Auto Scaling group with a step scaling policy controls scaling actions based on metrics, but it does not address the issue of retaining application logs after instances scale in.
AWS X-Ray is a service for tracing and analyzing the performance of applications, not for logging. While it can provide insight into the application’s behavior, it doesn’t retain detailed application logs, and it’s not a log storage solution.