# NOT RUN {
# This example applies a scaling policy to an Amazon ECS service called
# web-app in the default cluster. The policy increases the desired count
# of the service by 200%, with a cool down period of 60 seconds.
# }
# NOT RUN {
svc$put_scaling_policy(
PolicyName = "web-app-cpu-gt-75",
PolicyType = "StepScaling",
ResourceId = "service/default/web-app",
ScalableDimension = "ecs:service:DesiredCount",
ServiceNamespace = "ecs",
StepScalingPolicyConfiguration = list(
AdjustmentType = "PercentChangeInCapacity",
Cooldown = 60L,
StepAdjustments = list(
list(
MetricIntervalLowerBound = 0L,
ScalingAdjustment = 200L
)
)
)
)
# }
# NOT RUN {
# This example applies a scaling policy to an Amazon EC2 Spot fleet. The
# policy increases the target capacity of the spot fleet by 200%, with a
# cool down period of 180 seconds.",
#
# }
# NOT RUN {
svc$put_scaling_policy(
PolicyName = "fleet-cpu-gt-75",
PolicyType = "StepScaling",
ResourceId = "spot-fleet-request/sfr-45e69d8a-be48-4539-bbf3-3464e99c50c3",
ScalableDimension = "ec2:spot-fleet-request:TargetCapacity",
ServiceNamespace = "ec2",
StepScalingPolicyConfiguration = list(
AdjustmentType = "PercentChangeInCapacity",
Cooldown = 180L,
StepAdjustments = list(
list(
MetricIntervalLowerBound = 0L,
ScalingAdjustment = 200L
)
)
)
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab