ECS Auto Scaling-无法按CPU预留指标进行横向扩展

时间:2018-09-07 22:13:05

标签: autoscaling aws-ecs

我具有以下Auto Scaling策略,该策略应在CPU预留量超过75%时添加实例。我没有看到为此设置触发任何警报

Policy type:
Simple scaling
Execute policy when:
ECS-CPUHighAlarm
breaches the alarm threshold: CPUReservation > 75 for 5 consecutive periods 
of 60 seconds for the metric dimensions AutoScalingGroupName = ECS-
ECSAutoScalingGroup
Take the action:
Add 1 instances And then wait: 600 seconds before allowing another scaling 
activity

下面是CloudFormation脚本。

CPUHighAlarm:
Type: 'AWS::CloudWatch::Alarm'
Properties:
  EvaluationPeriods: 5
  Statistic: Average
  Threshold: 75
  AlarmDescription: 'Alarm if CPU reservation is high.'
  Period: 60
  AlarmActions:
  - !Ref 'CPUScalingUpPolicy'
  Namespace: 'AWS/ECS'
  Dimensions:
  - Name: AutoScalingGroupName
    Value: !Ref 'ECSAutoScalingGroup'
  ComparisonOperator: GreaterThanThreshold
  MetricName: CPUReservation

但根据我在以下图表中观察到的情况,它不会发生。 CPU Reservation Chart

是否对缺少配置有何想法?

1 个答案:

答案 0 :(得分:0)

我认为我找到了问题。它在CloudFormation模板中。在将名称空间用作AWS / ECS时,以下是有效维度,

Dimensions:
- Name: ClusterName
  Value: !Ref 'ECSClusterName'

因此,警报无效,被卡为INSUFFICIENT_DATA,我在阅读此内容后才意识到,

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ecs-metricscollected.html

我进行了测试,并且警报被触发并自动缩放。

相关问题