amazon-ecs-cli
amazon-ecs-cli copied to clipboard
Is there any plan to support the "Service Auto Scaling"?
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html
It is going to be very useful to have finer control of tasks. It does not a lot of samples or blog out there talking about this.
Thanks for your feedback.
ecs-cli has not integrate with service auto scaling yet. The current workaround for this is to use the ECS console or aws CLI.
+1 for that feature, as it would be very useful to bring up a ECS service via one command. If so, can it function similar to how the latest enchancement of ecs-cli added support for ALB target groups via specifying its ARN? I think that's the most straightforward way of getting the right resource.
Now that I looked into ECS auto scaling, and dived into the code, it's definitely a bit more complex...
My original thought was that auto scaling policies and what not are independent of ECS assets, like ALBs, target groups, and ELBs. However, each policy is tied tied to the ECS service in general...
Given that, trying to just to a flag aka how it's tied to an ELB or ALB might not make sense....
At this point, I'll work around this by having run the ECS CLI to add the autoscaling policy when the service is created/updated.
http://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/put-scaling-policy.html
@yinshiua, same question here: do you expect this to be done via Cloudformation, or through API calls?
@shatil We will need to propose a design on how the implementation would be. I do think we should use CloudFormation considering that we will be making multiple API calls to setup Service Autos Scaling and we need a way to clean up the resources if on fails.
Any plans w.r.t. this issue? I would like to have some ecs-cli command which could create a new autoscaling policy to the ECS's internal ASG resource (or assign somehow an existing service to external AS resources if it is simpler)
ecs-cli is very useful, thanks for it! Pavel
I want to go ahead and revisit this... In my mind, this is the one piece that is missing from being able to use ecs-cli from end to end. Right now, I use ecs-cli to compose the task service and definitions, and as a workaround and I'll probably write a terraform module to get these resources to finish the resources necessary to setup autoscaling.
a. application auto scaling policy b. application auto scaling target c. Cloudwatch metric alarms to trigger the auto scaling policy.
Given that ecs-cli now supports using ecs-params.yaml to support non docker-compose standard parameters, can it be extended to do so?
+1 to this feature request and comments by @vchan2002.
Hi. What is the state of this issue? It's a pretty basic need.
Use the below command for setting up target autoscaling policy using aws cli
1. Enable scaling on the service you have using this command
aws application-autoscaling register-scalable-target --resource-id "service/your-clustername/yourservice-name"
--service-namespace ecs
--scalable-dimension ecs:service:DesiredCount
--min-capacity 1 --max-capacity 3
--role-arn "specify-correct-arn-here-for-ecsAutoscaleRole"
2. Create json file specifying your policy Example : cpu-80.json { "PolicyName": "targetTrackingCpu80", "ServiceNamespace": "ecs", "ResourceId": "service/your-cluster-name/your-service-name>", "ScalableDimension": "ecs:service:DesiredCount", "PolicyType": "TargetTrackingScaling", "TargetTrackingScalingPolicyConfiguration": { "TargetValue": 80, "PredefinedMetricSpecification": { "PredefinedMetricType": "ECSServiceAverageCPUUtilization" }, "ScaleOutCooldown": 60, "ScaleInCooldown": 60, "DisableScaleIn": false } }
3. Run this command to apply the json file
aws application-autoscaling put-scaling-policy --cli-input-json file://cpu-80.json
@linearregression @vchan2002 @shatil @bver @adamjkeller @radiantone
Hey everyone, while the ECS CLI currently lacks support for this, we want to give some workarounds, in addition to the AWS CLI commands that @anigetsin showed:
Application autoscaling can be added after an ECS Service has been created. So our recommendation is to create your Service with the ECS CLI, and then add autoscaling using one of the following methods:
- ECS Console
The ECS Web UI has an easy-to-use wizard that can configure autoscaling on your service. Simply select your service in the Console, and click the update button to launch the wizard.
- AWS Cloud Developer Kit
The CDK example here demonstrates how to add autoscaling: https://awslabs.github.io/aws-cdk/refs/_aws-cdk_aws-ecs.html#task-autoscaling
- CloudFormation
The templates here show how to add autoscaling: https://containersonaws.com/architecture/autoscaling-service-containers/
Note that these template snippets don’t include the application autoscaling role. Here’s a snippet which you can use for that:
ApplicationAutoScalingRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- application-autoscaling.amazonaws.com
Action:
- sts:AssumeRole
Path: "/"
Policies:
- PolicyName: ECSAggregatorScalingRole
PolicyDocument:
Statement:
- Effect: Allow
Action:
- ecs:UpdateService
- ecs:DescribeServices
- application-autoscaling:*
- cloudwatch:DescribeAlarms
- cloudwatch:GetMetricStatistics
Resource: "*"
Thanks @PettitWesley I think that sums out all the options available for service auto scaling right now. I hope AWS brings this functionality in ecs-cli soon for us .
+1 for this feature
+1
+1 for making most of cloud infra, support for autoscaling is must, hope this will make it to the backlogs soon!
+1
+1
:+1: For this feature, it would be incredible useful to have this integrated into ecs-cli
+1
This is needed for sure