コード例 #1
0
        public void ApplicationAutoScalingPutScalingPolicy()
        {
            #region to-apply-a-target-tracking-scaling-policy-with-a-predefined-metric-specification-1569364247984

            var response = client.PutScalingPolicy(new PutScalingPolicyRequest
            {
                PolicyName        = "cpu75-target-tracking-scaling-policy",
                PolicyType        = "TargetTrackingScaling",
                ResourceId        = "service/default/web-app",
                ScalableDimension = "ecs:service:DesiredCount",
                ServiceNamespace  = "ecs",
                TargetTrackingScalingPolicyConfiguration = new TargetTrackingScalingPolicyConfiguration {
                    PredefinedMetricSpecification = new PredefinedMetricSpecification {
                        PredefinedMetricType = "ECSServiceAverageCPUUtilization"
                    },
                    ScaleInCooldown  = 60,
                    ScaleOutCooldown = 60,
                    TargetValue      = 75
                }
            });

            List <Alarm> alarms    = response.Alarms;
            string       policyARN = response.PolicyARN;

            #endregion
        }
        public void ApplicationAutoScalingPutScalingPolicy()
        {
            #region to-apply-a-scaling-policy-to-an-amazon-ecs-service-1470864779862

            var response = client.PutScalingPolicy(new PutScalingPolicyRequest
            {
                PolicyName        = "web-app-cpu-gt-75",
                PolicyType        = "StepScaling",
                ResourceId        = "service/default/web-app",
                ScalableDimension = "ecs:service:DesiredCount",
                ServiceNamespace  = "ecs",
                StepScalingPolicyConfiguration = new StepScalingPolicyConfiguration {
                    AdjustmentType  = "PercentChangeInCapacity",
                    Cooldown        = 60,
                    StepAdjustments = new List <StepAdjustment> {
                        new StepAdjustment {
                            MetricIntervalLowerBound = 0,
                            ScalingAdjustment        = 200
                        }
                    }
                }
            });

            string policyARN = response.PolicyARN;

            #endregion
        }