我创建了一个自动缩放目标和一个附加到它的策略。
AutoScalingPolicy:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: !Join ['', [!Ref ServiceName, auto-scaling-policy]]
PolicyType: TargetTrackingScaling
ScalingTargetId: !Ref AutoScalingTarget
TargetTrackingScalingPolicyConfiguration:
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageCPUUtilization
ScaleInCooldown: 10
ScaleOutCooldown: 10
# Keep things at or lower than 50% CPU utilization, for example
TargetValue: !Ref AutoScalingTargetValue
这将创建 cloudwatch 警报:
高的: 3 datapoints within 3 minutes
低的: 15 datapoints within 15 minutes
我想将其自定义为:
高的: 1 datapoint within 1 minute
低的: 1 datapoint within 1 minute
我可以从 AWS 控制台手动执行此操作。但是,正在努力寻找一种使用 cloudformation 模板执行相同操作的方法。