Configure monitoring for Auto Scaling instances
Amazon EC2 collects and processes raw data from instances into readable, near real-time metrics that describe the CPU and other usage data for your Auto Scaling group. You can configure the interval for monitoring these metrics by choosing one-minute or five-minute granularity.
Instance monitoring is enabled whenever an instance is launched, using either basic
monitoring (five-minute granularity) or detailed monitoring (one-minute granularity).
For detailed monitoring, additional charges apply. For more information, see Amazon CloudWatch pricing
Before creating an Auto Scaling group, you should create a launch template or launch configuration that permits the type of monitoring that is appropriate to your application. If you add a scaling policy to your group, we strongly recommend that you use detailed monitoring to get metric data for EC2 instances at a one-minute granularity, because that achieves a faster response to changes in load.
Contents
Enable detailed monitoring (console)
By default, basic monitoring is enabled when you use the AWS Management Console to create a launch template or launch configuration.
To enable detailed monitoring in a launch template
When you create the launch template using the AWS Management Console, in the Advanced details section, for Detailed CloudWatch monitoring, choose Enable. Otherwise, basic monitoring is enabled. For more information, see Create a launch template using advanced settings.
To enable detailed monitoring in a launch configuration
When you create the launch configuration using the AWS Management Console, in the Additional configuration section, select Enable EC2 instance detailed monitoring within CloudWatch. Otherwise, basic monitoring is enabled. For more information, see Create a launch configuration.
Enable detailed monitoring (AWS CLI)
By default, basic monitoring is enabled when you create a launch template using the AWS CLI. Detailed monitoring is enabled by default when you create a launch configuration using the AWS CLI.
To enable detailed monitoring in a launch template
For launch templates, use the create-launch-template"Monitoring":{"Enabled":true}
to enable detailed monitoring or
"Monitoring":{"Enabled":false}
to enable basic monitoring.
To enable detailed monitoring in a launch configuration
For launch configurations, use the create-launch-configuration--instance-monitoring
option. Set this option to
true
to enable detailed monitoring or false
to
enable basic monitoring.
--instance-monitoring Enabled=
true
Switch between basic and detailed monitoring
To change the type of monitoring enabled on new EC2 instances, update the launch
template or update the Auto Scaling group to use a new launch template or launch
configuration. Existing instances continue to use the previously enabled monitoring
type. To update all instances, terminate them so that they are replaced by your Auto Scaling
group or update instances individually using monitor-instances
Note
With the instance refresh and maximum instance lifetime features, you can also replace all instances in the Auto Scaling group to launch new instances that use the new settings. For more information, see Replace the instances in your Auto Scaling group.
When you switch between basic and detailed monitoring:
If you have CloudWatch alarms associated with the step scaling policies or simple
scaling policies for your Auto Scaling group, use the put-metric-alarm
Collect additional metrics using the CloudWatch agent
To collect operating system-level metrics like available and used memory, you must install the CloudWatch agent. Additional fees may apply. You can use the CloudWatch agent to collect both system metrics and log files from Amazon EC2 instances. For more information, see Metrics collected by the CloudWatch agent in the Amazon CloudWatch User Guide.