question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-ecs): autoScaleTaskCount and scaleOnCpuUtilization don't add scaling policies to ECS service

See original GitHub issue

I’m trying to set up target scaling for an ECS service following the documentation, but it doesn’t seem to be doing anything.

Reproduction Steps

        service.autoScaleTaskCount(
            EnableScalingProps.builder()
                .minCapacity(app.minInstanceCount)
                .maxCapacity(app.maxInstanceCount)
                .build()
        ).scaleOnCpuUtilization(
            "cpuScaling",
            CpuUtilizationScalingProps.builder()
                .scaleInCooldown(app.scaleInCooldown)
                .scaleOutCooldown(app.scaleOutCooldown)
                .targetUtilizationPercent(app.targetCpuUtilizationPercent)
                .build()
        )

What did you expect to happen?

I expect to see something like this: Screenshot 2021-04-21 at 09 47 36

What actually happened?

Instead I see: Screenshot 2021-04-21 at 09 42 14

Environment

  • CDK CLI Version : 1.99.0
  • Framework Version: 1.99.0
  • Node.js Version: v14.15.0
  • OS : MacOs BigSur
  • Language (Version): Kotlin (Java 11)

Other

What this looks like in CloudFormation: Screenshot 2021-04-21 at 10 33 00


This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
FelixRellicommented, Nov 12, 2021

Probably related: For scheduledTasks (scaleOnSchedule) the scaling is working, but they do not show under Scheduled Tasks in the UI.

    const scaling = ecsService.autoScaleTaskCount({ maxCapacity: 1 });
    scaling.scaleOnSchedule('StartVectorizationTask', {
      schedule: Schedule.cron({ minute: '10' }),
      maxCapacity: 1,
      minCapacity: 1,
    });
    scaling.scaleOnSchedule('StopVectorizationTask', {
      schedule: Schedule.cron({ minute: '20' }),
      maxCapacity: 0,
      minCapacity: 0,
    });

image

cdk v. 1.129.0

0reactions
awsivcommented, Feb 15, 2022

This is because the ClusterName now contains ARN, but Cloudwatch alarm (for autoscaling) doesn’t like it.

If you change to using cluster name, it should be fine - however this requires an additional step to change the cluster name. CDK should handle it properly

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step 5: Configuring your service to use Service Auto Scaling
Amazon ECS Service Auto Scaling supports the following types of scaling policies: Target tracking scaling policies (Recommended)—Increase or decrease the number ...
Read more >
Configure Amazon ECS Service Auto Scaling on Fargate
When your CloudWatch alarms trigger an Auto Scaling policy, Application Auto Scaling decides the new desired count based on the configured ...
Read more >
Service auto scaling - Amazon Elastic Container Service
Amazon ECS Service Auto Scaling supports the following types of automatic scaling: Target tracking scaling policies— Increase or decrease the number of tasks ......
Read more >
Troubleshoot service auto scaling issues in Amazon ECS
Your ECS Cluster doesn't have enough resources or capacity to run new tasks. Resolution. Troubleshooting CloudWatch alarms and scaling policies.
Read more >
ECS Service Auto-Scaling with the CDK - Idan Lupinsky
This is an AWS service that manages scaling of other services such as DynamoDB, RDS, and ECS. Each of these managed services consists...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found