1
resposta

Comando para criação de alarme não funciona

O comando a seguir não funciona:

aws cloudwatch create-alarm --alarm-name MyEC2Alarm --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --evaluation-periods 2 --threshold 80 --comparison-operator GreaterThanThreshold --alarm-actions arn:aws:sns:us-east-1:123456789012:my-topic

Pois não tem mais a opção "create-alarm":

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

delete-alarms                            | delete-anomaly-detector                 
delete-dashboards                        | delete-insight-rules                    
delete-metric-stream                     | describe-alarm-history                  
describe-alarms                          | describe-alarms-for-metric              
describe-anomaly-detectors               | describe-insight-rules                  
disable-alarm-actions                    | disable-insight-rules                   
enable-alarm-actions                     | enable-insight-rules                    
get-dashboard                            | get-insight-rule-report                 
get-metric-data                          | get-metric-statistics                   
get-metric-stream                        | get-metric-widget-image                 
list-dashboards                          | list-managed-insight-rules              
list-metric-streams                      | list-metrics                            
list-tags-for-resource                   | put-anomaly-detector                    
put-composite-alarm                      | put-dashboard                           
put-insight-rule                         | put-managed-insight-rules               
put-metric-alarm                         | put-metric-data                         
put-metric-stream                        | set-alarm-state                         
start-metric-streams                     | stop-metric-streams                     
tag-resource                             | untag-resource                          
wait                                     | help                            

Qual posso usar?

1 resposta

DOCS: https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-metric-alarm.html

Pelo oque achei o comando seria put-metric-alarm onde você consegue atualizar ou criar um alarme, você consegue usar os mesmos parâmetros:

aws cloudwatch put-metric-alarm --alarm-name "MyEC2Alarm" --metric-name "CPUUtilization" --namespace "AWS/EC2" --statistic "Average" --period 300 --evaluation-periods 2 --threshold 80 --comparison-operator "GreaterThanThreshold" --alarm-actions "arn:aws:sns:us-east-1:123456789012:my-topic"