How do I disable detailed monitoring for instances

2019-05-02 04:26发布

问题:

I'm using CloudFormation to spin up some servers in an auto scaling group, and I want them all to use basic monitoring. I tried setting Monitoring to false in the AWS::AutoScaling::AutoScalingGroup properties as well as the AWS::AutoScaling::LaunchConfiguration, but the stack cannot start up; I see CREATE_FAILED with the error message: Encountered unsupported property Monitoring.

回答1:

Just another day in the lovingly roguish world of almost-but-not-quite-consistant CFN template syntax.

The property you want is InstanceMonitoring, not Monitoring. It should apply to your LaunchConfiguration resource. More details are in the docs.

InstanceMonitoring

Indicates whether or not instance monitoring should be enabled for this
    autoscaling group. This is enabled by default. To turn it off, set
    InstanceMonitoring to "false".

Required: No. Default value is "true".
Type: Boolean

Of course, if you're provisioning an AWS::EC2::Instance resource, it's just straight up Monitoring. For what it's worth, I find this slightly less annoying than changing SecurityGroups to SecurityGroupIds when moving Instance declarations in and out of VPCs, but that's just me.