简体   繁体   中英

AWS CLI: Attach an existing cloudwatch alarm to an existing auto scaling policy

I'm having trouble attaching previously created alarms to an auto scaling group policy. I have created the policy like so:

aws autoscaling put-scaling-policy --policy-name my-scaleout-policy --auto-scaling-group-name my-group --scaling-adjustment 2 --adjustment-type ChangeInCapacity

However, I can't seem to find the correct CLI command to attach an already created alarm my-cpu-alarm to the policy.

Update the existing alarm & add the policy ARN in --alarm-actions parameter.

You can use the put-metric-alarm command for this. Note that you will have to give all the original parameters to update the alarm as they are overwritten.

You can get the alarm parameters using describe-alarm .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM