Identify any Amazon EC2 instances that appear to be overutilized and upgrade (resize) them in order to help your EC2-hosted applications to handle better the workload and improve the response time. By default, an EC2 instance is considered "overutilized" when matches the following criteria:
The average CPU utilization has been more than 90% for the last 7 days.
The average memory utilization has been more than 90% for the last 7 days. By default, AWS CloudWatch cannot record an EC2 instance memory utilization because the necessary metric cannot be implemented at the hypervisor level, therefore to be able to report the memory utilization using CloudWatch you need to install an agent (PERL script) on the instance that you want to monitor and create a custom metric (we`ll name it EC2MemoryUtilization) on the CloudWatch dashboard. The instructions required for installing the monitoring agent, based on the Operating System used by instance, are available at this URL.
Overutilized instances could indicate that the applications running on these machines do not have enough hardware resources to perform optimally. Upgrading (upsizing) overutilized EC2 instances (vertical scaling) or adding more instances to your Auto Scaling Groups (horizontal scaling) to meet the load needs will improve directly the health and success of your applications, resulting in a more stable environment and a faster response time.
To identify any overutilized EC2 instances that could benefit from a more efficient hardware configuration, perform the following:
Case A: Upgrade (upsize) the overused EC2 instances provisioned within your AWS account by adding more hardware resources (CPU and RAM memory) to the existing instances (vertical scaling). To resize an overutilized EC2 instance, perform the following commands:(!) Important note: the following process assumes that the EC2 instances selected for upgrade are NOT currently used in production or for critical operations. To resize production instances without any downtime, you should create a snapshot of your current image and launch a new instance from that snapshot using the required instance type.
Case B: Increase the capacity of the Auto Scaling Group (ASG) consisting of overused EC2 instances by adding more machines (instances) to the existing group (horizontal scaling). To upgrade an overutilized AWS Auto Scaling Group, perform the following commands: