You created an auto scaling group through the management console. The issue is "group metrics collection is not enabled for the following auto scaling groups" and; you would simply like to know how to enable metric collection using the AWS CLI. Here you will a bash function aws-cli wrapper to help automate enabling metrics collection for autoscaling groups in AWS.
Today in AWS, enabling metrics collection for an auto scaling group was on my to-do list. (28 Jul 2017)
This page dedicated to the task of enabling auto scaling metrics collection.
As you may know by know, group metrics collection in AWS is not enabled by default for auto scaling groups. Why?
If you are really in a hurry to enable auto scaling metrics collection in AWS that you are currently working on, here is the aws-cli shortcut you need.
If you've ever picked up where you left off, in the middle of a test, or are in your free tier period, you will find out or be reminded that metrics collection is not enabled by default. So, what do you do?
Why enable auto scaling metrics collection?
Metrics collection is used by scaling policies to achieve autoscaling.
Auto scaling groups are created without enabled metrics by default. Auto scaling group metrics collection may be enabled manually via command line through the aws-cli.
The following options are required by the 'enable-metrics-collection' command of the 'aws autoscaling' command namespace.
The name or ARN of the auto scaling group is required.
Despite the only valid value being "1Minute", granularity is required.
enable-metrics-collection() { { local auto_scaling_group_name ; auto_scaling_group_name="${1}" ; }
local granularity
granularity="1Minute"
aws
autoscaling
enable-metrics-collection
--auto-scaling-group-name "${auto_scaling_group_name}"
--granularity "${granularity}"
}
(3 Feb 2019) Minor revision
(12 Jan 2018) Update example converting original bash example code into a aws-cli wrapper bash function
( 7 Aug 2017) Add introduction
(28 Jul 2017) Create document