pgarbe / ecs-autoscaling

25 stars 6 forks source link

Not scaling service #2

Open yellenseram opened 7 years ago

yellenseram commented 7 years ago

I've a similar scaling policy defined but I see that it scales the Autoscaling group abut doesn't scale the tasks in the ECS service.

"MyAutoScaleUpPolicy" : { "Type" : "AWS::AutoScaling::ScalingPolicy", "Properties" : { "AdjustmentType" : "ChangeInCapacity", "AutoScalingGroupName" : { "Ref" : "MyAutoScalingGroup" }, "Cooldown" : "100", "ScalingAdjustment" : "1" } }, "MyAsCPUAlarmHigh": { "Type": "AWS::CloudWatch::Alarm", "Properties": { "EvaluationPeriods": "2", "Statistic": "Average", "Threshold": "75", "AlarmDescription": "Alarm if CPU>=75% or metric disappears indicating instance is down", "Period": "180", "AlarmActions": [ { "Ref": "MyAutoScaleUpPolicy" } ], "Namespace": "AWS/ECS", "Dimensions": [ { "Name": "ClusterName", "Value": { "Ref": "MyCluster" } } ], "ComparisonOperator": "GreaterThanOrEqualToThreshold", "MetricName": "CPUUtilization" } },

Any advice?

pgarbe commented 7 years ago

There are two different kinds of scaling. The AutoScalingGroup (ASG) is used to scale the cluster, Application AutoScaling is used to scale an ECS service.

Here's a tutorial how to do it in the Console http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_autoscaling_tutorial.html and this is the corresponding CloudFormation resource http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html