By replacing the M5 instances with R5 instances, which are optimized for memory-intensive workloads, the application can benefit from increased memory capacity and performance.
In addition, deploying the CloudWatch agent on the EC2 instances allows for the generation of custom application latency metrics, which can provide valuable insights into the application's performance.
This solution addresses the performance issues efficiently by leveraging the appropriate instance types and collecting custom application metrics for better monitoring and future capacity planning.
A. Replacing with T3 instances may not provide enough memory capacity for in-memory tasks.
B. Manually increasing the capacity of the ASG does not directly address the performance issues.
C. Relying solely on built-in EC2 memory metrics may not provide enough granularity for optimizing in-memory tasks.
The most efficient solution is to modify the CloudFormation templates, replace with R5 instances, and deploy the CloudWatch agent for custom metrics.