Skip to content

feat(applicationautoscaling): add high-resolution ECS predefined metrics - #38219

Open
sanyamk23 wants to merge 3 commits into
aws:mainfrom
sanyamk23:feat/add-high-resolution-ecs-metrics
Open

feat(applicationautoscaling): add high-resolution ECS predefined metrics#38219
sanyamk23 wants to merge 3 commits into
aws:mainfrom
sanyamk23:feat/add-high-resolution-ecs-metrics

Conversation

@sanyamk23

Copy link
Copy Markdown

Motivation

Closes #38207

Amazon ECS now supports high-resolution (20-second) metrics for faster auto scaling, but the CDK PredefinedMetric enum in aws-applicationautoscaling is missing the corresponding high-resolution variants. This forces users to use error-prone string literals when authoring high-resolution target-tracking policies.

Changes

Added two new members to the PredefinedMetric enum:

Enum member CloudFormation PredefinedMetricType
ECS_SERVICE_AVERAGE_CPU_UTILIZATION_HIGH_RESOLUTION ECSServiceAverageCPUUtilizationHighResolution
ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION_HIGH_RESOLUTION ECSServiceAverageMemoryUtilizationHighResolution

Each new member includes JSDoc with a @see link to the ECS high-resolution scaling guide.

README

Added a new section under ECS Service Auto Scaling showing how to create a ScalableTarget and attach high-resolution tracking policies, with a note about the two-step constraint for existing services.

Tests

Added two unit tests verifying that each new metric value is rendered correctly in the synthesized AWS::ApplicationAutoScaling::ScalingPolicy template.

Testing

npx jest aws-applicationautoscaling/test/target-tracking.test.ts

Note: The full test suite requires the generated source to be built first (npx lerna run build --scope=aws-cdk-lib --stream). The new enum values follow the same pattern as all existing PredefinedMetric members and are string-literal mappings with no logic, so the risk of regressions is minimal.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Jun 30, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team June 30, 2026 18:47
@github-actions github-actions Bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Jun 30, 2026

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation
aws-cdk-automation dismissed their stale review July 2, 2026 14:08

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@sanyamk23 sanyamk23 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@sanyamk23

Copy link
Copy Markdown
Author

Full CI including build is green. Ready for review.

@sanyamk23

sanyamk23 commented Aug 11, 2026

Copy link
Copy Markdown
Author

Hi @otaviomacedo, I added high-resolution 1-minute ECS predefined metrics for Application Auto Scaling. Could you take a look?

@sanyamk23
sanyamk23 force-pushed the feat/add-high-resolution-ecs-metrics branch from 97c8392 to 53794fc Compare August 17, 2026 12:19
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 12:19 — with GitHub Actions Active
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 12:19 — with GitHub Actions Active
@sanyamk23
sanyamk23 force-pushed the feat/add-high-resolution-ecs-metrics branch from 53794fc to ebe7aac Compare August 17, 2026 19:46
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:46 — with GitHub Actions Active
@sanyamk23
sanyamk23 deployed to automation August 17, 2026 19:46 — with GitHub Actions Active
…ross-repo PRs

When the GitHub API returns a 404 for the list reviews endpoint (which
can happen for cross-repo PRs from forks or when the PROJEN_GITHUB_TOKEN
lacks access to the source repository), treat it as no existing reviews
rather than crashing the entire validate-pr job.

Previously, the 404 error would propagate up to run().catch() in index.ts,
causing the process to exit with code 1 and failing the workflow.
Add ECS_SERVICE_AVERAGE_CPU_UTILIZATION_HIGH_RESOLUTION and
ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION_HIGH_RESOLUTION to the
PredefinedMetric enum, enabling target-tracking scaling policies
that use 20-second metric reporting for faster auto scaling.

closes aws#38207
…n ECS metrics

Add integration test and snapshot verifying that ECS high-resolution
(20-second) predefined metrics for CPU and memory utilization can be
used in target tracking scaling policies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-ecs: support high-resolution (20s) service metrics for faster service auto scaling

4 participants