In the context of AWS, if you are considering updating from m5.xlarge to an m5.2xlarge Instance to address the occasional performance degradation during peak usage times, then you must validate the specific resource bottleneck causing the performance issues:-
Resource bottleneck
Try to determine if the performance degradation is due to CPU, memory, or other resource limitations. This can be analyzed by using monitoring tools such as AWS cloud watch metrics or server-side performance monitoring tools.
CPU-intensive workloads
If you find that performance degradation is primarily CPU-bound, then try to update to m5.2xlarge Instances with even more vCPUs which can help you alleviate CPU bottlenecks and improve application responsiveness during peak loads.
Memory-intensive workloads
Conversely, if you find that the performance issues are related to the constraints within memory, then you can try to upgrade the instances with more Memory, such as r5.xlarge or r5.2xlarge.
Aws ec2 modify-instance-attribute –instance-id YOUR_INSTANCE_ID –instance-type m5.2xlarge