ターゲット追跡スケーリングポリシーで定義済メトリクス以外を追加

ターゲット追跡スケーリングポリシーで定義済メトリクス以外を追加:

既存のスケーリングポリシーがあれば消しておく

$ aws autoscaling delete-policy --policy-name handson-as-policy --auto-scaling-group-name handson-as-grp  
config.jsonでスケーリングポリシーの定義を作っておく

$ cat config.json  
{ 
  "CustomizedMetricSpecification": { 
    "MetricName": "DiskWriteOps", 
    "Dimensions": [ 
      { 
        "Name": "AutoScalingGroupName", 
        "Value": "handson-as-grp" 
      } 
    ], 
    "Namespace": "EC2", 
    "Statistic": "Average", 
    "Unit": "None" 
  }, 
  "TargetValue": 200, 
  "DisableScaleIn": false 
} 
tmp-diskという名前でスケーリングポリシーを追加

追加先はターゲット追跡スケーリングポリシーで作成されたAutoScalingGroupのhandson-as-grp

以下のようにターゲット追跡スケーリングポリシーなのでスケールアウト/スケールインのアラームも2つ作成されています。ターゲット追跡スケーリングポリシーを消すとアラームも消えます

$ aws autoscaling put-scaling-policy --policy-name tmp-disk --auto-scaling-group-name handson-as-grp --policy-type TargetTrackingScaling --target-tracking-configuration file://config.json 
{ 
    "Alarms": [ 
        { 
            "AlarmName": "TargetTracking-handson-as-grp-AlarmHigh-9b96e6c4-f5e4-4b3a-870d-9f17b2d68d14",  
            "AlarmARN": "arn:aws:cloudwatch:ap-northeast-1:xxxxxxxxxxxx:alarm:TargetTracking-handson-as-grp-AlarmHigh-9b96e6c4-f5e4-4b3a-870d-9f17b2d68d14" 
        },  
        { 
            "AlarmName": "TargetTracking-handson-as-grp-AlarmLow-de827d81-bce3-4d46-86ec-03396c639745",  
            "AlarmARN": "arn:aws:cloudwatch:ap-northeast-1:xxxxxxxxxxxx:alarm:TargetTracking-handson-as-grp-AlarmLow-de827d81-bce3-4d46-86ec-03396c639745" 
        } 
    ],  
    "PolicyARN": "arn:aws:autoscaling:ap-northeast-1:xxxxxxxxxxxx:scalingPolicy:cbfffc44-3c0e-459f-a976-42de82284d87:autoScalingGroupName/handson-as-grp:policyName/tmp-disk" 
} 


スクリーンショット 0030-12-28 9.57.03.png


スクリーンショット 0030-12-28 9.56.43.png

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)