Examples:
Example: To apply a target tracking scaling policy with a predefined metric specification
resp = client.put_scaling_policy({
policy_name: "cpu75-target-tracking-scaling-policy",
policy_type: "TargetTrackingScaling",
resource_id: "service/default/web-app",
scalable_dimension: "ecs:service:DesiredCount",
service_namespace: "ecs",
target_tracking_scaling_policy_configuration: {
predefined_metric_specification: {
predefined_metric_type: "ECSServiceAverageCPUUtilization",
},
scale_in_cooldown: 60,
scale_out_cooldown: 60,
target_value: 75,
},
})
{
alarms: [
{
alarm_arn: "arn:aws:cloudwatch:us-west-2:012345678910:alarm:TargetTracking-service/default/web-app-AlarmHigh-d4f0770c-b46e-434a-a60f-3b36d653feca",
alarm_name: "TargetTracking-service/default/web-app-AlarmHigh-d4f0770c-b46e-434a-a60f-3b36d653feca",
},
{
alarm_arn: "arn:aws:cloudwatch:us-west-2:012345678910:alarm:TargetTracking-service/default/web-app-AlarmLow-1b437334-d19b-4a63-a812-6c67aaf2910d",
alarm_name: "TargetTracking-service/default/web-app-AlarmLow-1b437334-d19b-4a63-a812-6c67aaf2910d",
},
],
policy_arn: "arn:aws:autoscaling:us-west-2:012345678910:scalingPolicy:6d8972f3-efc8-437c-92d1-6270f29a66e7:resource/ecs/service/default/web-app:policyName/cpu75-target-tracking-scaling-policy",
}
Request syntax with placeholder values
resp = client.put_scaling_policy({
policy_name: "PolicyName", service_namespace: "ecs", resource_id: "ResourceIdMaxLen1600", scalable_dimension: "ecs:service:DesiredCount", policy_type: "StepScaling", step_scaling_policy_configuration: {
adjustment_type: "ChangeInCapacity", step_adjustments: [
{
metric_interval_lower_bound: 1.0,
metric_interval_upper_bound: 1.0,
scaling_adjustment: 1, },
],
min_adjustment_magnitude: 1,
cooldown: 1,
metric_aggregation_type: "Average", },
target_tracking_scaling_policy_configuration: {
target_value: 1.0, predefined_metric_specification: {
predefined_metric_type: "DynamoDBReadCapacityUtilization", resource_label: "ResourceLabel",
},
customized_metric_specification: {
metric_name: "MetricName", namespace: "MetricNamespace", dimensions: [
{
name: "MetricDimensionName", value: "MetricDimensionValue", },
],
statistic: "Average", unit: "MetricUnit",
},
scale_out_cooldown: 1,
scale_in_cooldown: 1,
disable_scale_in: false,
},
})
Response structure
resp.policy_arn resp.alarms resp.alarms[0].alarm_name resp.alarms[0].alarm_arn
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4