Cloudwatch your EC2 instances in AWS
Cloud watch integrated with other AWS services for monitoring and provides two primary types of monitoring on EC2.
The first type is a system status check. This includes monitoring of the network connection, system power, hardware issues on the physical host and software issues on the physical host.
Note: If you start and stop the instance (forcing it to launch on a new physical hardware type) it often resolves these physical issues.
Instance status checks look at the software configuration, network configuration, start up config, exhausted memory and corrupted file system. All of these issues are going to be out fault – these are not hardware issues. We therefore need to either fix the config issue or rebuild the AMI with the correct config.
Cloudwatch lets us monitor the AWS infrastructure. We can integrate with SNS (Simple Notification Service) to make it communicate specific events on our system.
By default Cloudwatch will monitor metrics at the host and not the SW level. By default CPU usage, Network input output, disk utilization can be monitored.
Basic level monitoring is done by default on a 5 minute period basis. Detailed monitoring goes every 1 minute but does cost more.
To test Cloudwatch with EC2, login to your AWS dashboard and open EC2. Click on one of the instances that you’d like to look at and select the status check tab.
You can click “create status check alarm” to use SNS messaging to alarm you if a partisular event occurs.
You’ll notice in this windows that memory usage is not there. This requires additional checks. This only monitors those items at the physical layer.
You’ll notice that there is a check for CPU credit usage. This is to do with the T2 instance type (which provides baseline performance that is burstable). This means that a T2 micro instance can have a base level performance of 20% CPU, however, if it uses less than 20%, you can accrue credits, enabling you to burst above the 20% baseline when there is heavy demand on the instance.
This would not be useful if we needed consistent CPU utilization (so don’t use a T2 for this) but it could be a good solution for development environment. This is ideal if you do not need consistent performance.
In the Cloudwatch screen, you can look at metrics. This shows us the CPU credit balance and will enable you to compare and graph against the other instances.
We can also set up billing metrics. E.g. when our estimated charges reach $X a month.
Click on the EC2 tab. Take a look at CPU utilization – here you can see a chart of this information. You can create an alarm whenever CPU usage is X% for consecutive periods.
We can set notifications or even set an action on an instance (e.g. stop the instance or auto scale the instance).
This article was brought to you by Netshock. Netshock aim to provide technology guides and insight to our readers