Skip to content

Conversation

@jasdeepbhalla
Copy link
Contributor

Issue # (if applicable)

Closes #36119

Reason for this change

AWS recently introduced configurable scale-in delay for ECS Managed Instances via the InfrastructureOptimization.ScaleInAfter property.

This capability is currently available in CloudFormation but is not exposed in the CDK L2 construct ManagedInstancesCapacityProvider.

Exposing this option allows CDK users to:

  • Control how long ECS waits before optimizing idle or underutilized EC2 instances
  • Reduce unnecessary instance churn
  • Adopt the latest ECS Managed Instances features without using escape hatches

Description of changes

This PR adds native L2 support for configuring the ECS Managed Instances scale-in delay:

  • Added a new optional property: scaleInAfter?: Duration to ManagedInstancesCapacityProviderProps
  • When specified, the construct now synthesizes:
ManagedInstancesProvider:
  InfrastructureOptimization:
    ScaleInAfter: <seconds>
  • The property is only emitted when explicitly provided, preserving default ECS behavior
  • Added validation to ensure the value is within AWS-supported limits (0–3600 seconds)
  • This change is backward-compatible and does not alter existing behavior unless the new property is used.

Describe any new or updated permissions being added

None

Description of how you validated changes

  • Added Unit and Integration tests for this change

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Dec 20, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team December 20, 2025 00:54
@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 Dec 20, 2025
Copy link
Collaborator

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

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 December 22, 2025 02:21

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results50 ran50 passed
TestResult
No test annotations available

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates50 ran50 passed
TestResult
No test annotations available

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-ecs: missing scaleInAfter property in ManagedInstancesCapacityProvider

2 participants