Open genadis opened 2 years ago
Is this on the roadmap? This would be a really useful feature. Without it, as @genadis you need to use the autoscaling group or just hack around in the console after the deployment. Would like to get these in crosswalk FargateService
->
Hi!
Actually, you can write autoscaling for ECS Fargate using Pulumi aws.appautoscaling
(docs) and there is no need to use CLI commands for that from here https://aws.amazon.com/premiumsupport/knowledge-center/ecs-fargate-service-auto-scaling/.
@tymofii-okh thank you I will give this a shot. This would be really useful in the documentation as auto-scaling a Fargate cluster is pretty useful. Currently it only shows how to auto-scale native ECS
Thank you @tymofii-okh for the guidance. Here the example from the docs.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ecsTarget = new aws.appautoscaling.Target("ecsTarget", {
maxCapacity: 4,
minCapacity: 1,
resourceId: "service/clusterName/serviceName",
scalableDimension: "ecs:service:DesiredCount",
serviceNamespace: "ecs",
});
const ecsPolicy = new aws.appautoscaling.Policy("ecsPolicy", {
policyType: "StepScaling",
resourceId: ecsTarget.resourceId,
scalableDimension: ecsTarget.scalableDimension,
serviceNamespace: ecsTarget.serviceNamespace,
stepScalingPolicyConfiguration: {
adjustmentType: "ChangeInCapacity",
cooldown: 60,
metricAggregationType: "Maximum",
stepAdjustments: [{
metricIntervalUpperBound: "0",
scalingAdjustment: -1,
}],
},
});
https://www.pulumi.com/registry/packages/aws/api-docs/appautoscaling/target/#ecs-service-autoscaling https://www.pulumi.com/registry/packages/aws/api-docs/appautoscaling/policy/#ecs-service-autoscaling
Hi, I noticed that neither aws.appautoscaling.Policy
or aws.appautoscaling.PolicyStepScalingPolicyConfigurationArgs
support attaching cloudwatch alarms to the scaling policy. This is possible via the AWS console but I can't see a way of creating a step policy with a cloudwatch alarm via Pulumi. If it's already possible in Pulumi and I've missed it then it would be much appreciated if someone could point me in the right direction. Thanks!
Ah so it looks like you need to attach the scaling policy to the cloudwatch alarm as an alarm_action
. Seems like there is disparity between how it's provisioned in AWS console and pulumi/terraform.
We are using ECS FargateService, and would like the tasks to be auto-scalable. At the moment this cannot be easily achieved. Our only option now is to switch to ECS EC2Service and use the Autoscaling group.
AWS does support ECS Fargate service autoscaling (via CloudWatch alarms): https://aws.amazon.com/premiumsupport/knowledge-center/ecs-fargate-service-auto-scaling/
This can be configured via AWS Console, would be great to have this support in Crosswalk similar to createAutoScalingGroup.
Affected feature
ECS FargateService