Skip to content

feat(ecs): add useLocalStorage support for ManagedInstancesCapacityProvider#37574

Open
badmintoncryer wants to merge 6 commits intoaws:mainfrom
badmintoncryer:feat/ecs-managed-instances-use-local-storage
Open

feat(ecs): add useLocalStorage support for ManagedInstancesCapacityProvider#37574
badmintoncryer wants to merge 6 commits intoaws:mainfrom
badmintoncryer:feat/ecs-managed-instances-use-local-storage

Conversation

@badmintoncryer
Copy link
Copy Markdown
Contributor

@badmintoncryer badmintoncryer commented Apr 12, 2026

Issue # (if applicable)

N/A

Reason for this change

localStorageConfiguration.useLocalStorage has been available in the L1 CfnCapacityProvider resource since ECS Managed Instances was introduced, but there was no L2 surface for it. Without setting useLocalStorage: true, tasks on Managed Instances would use EBS-backed storage even when the selected instance types have local NVMe storage (instance store).

Description of changes

Adds useLocalStorage?: boolean to ManagedInstancesCapacityProviderProps. When set to true, it maps to localStorageConfiguration.useLocalStorage: true in the synthesized AWS::ECS::CapacityProvider resource, causing ECS to use instance store volumes instead of EBS for task storage.

Validation logic at synthesis time:

useLocalStorage instanceRequirements.localStorage Result
true REQUIRED No warning
true INCLUDED Warning: instances without local storage may be selected
true EXCLUDED Hard error: contradictory configuration
true not set (instanceRequirements provided) Auto-set to REQUIRED
true not set (instanceRequirements omitted) Warning: recommend specifying instanceRequirements

Describe any new or updated permissions being added

None.

Description of how you validated changes

Add both unit and integ test.

Checklist


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

…ovider

Add `useLocalStorage` prop to `ManagedInstancesCapacityProvider` that maps to
`localStorageConfiguration.useLocalStorage` in the L1 resource, enabling ECS
to use instance store (local NVMe) volumes instead of EBS for task storage.

Validation logic:
- `useLocalStorage: true` + `localStorage: EXCLUDED` → hard error (contradictory)
- `useLocalStorage: true` + `localStorage: INCLUDED` → synthesis warning
- `useLocalStorage: true` + `instanceRequirements` omitted → synthesis warning
- `useLocalStorage: true` + `localStorage` omitted → auto-set to REQUIRED

Closes #XXXXX
@github-actions github-actions bot added the p2 label Apr 12, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 12, 2026 01:25
@github-actions github-actions bot added the distinguished-contributor [Pilot] contributed 50+ PRs to the CDK label Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 12, 2026

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


TestsPassed ✅SkippedFailed
Security Guardian Results48 ran48 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 12, 2026

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


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates48 ran48 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 12, 2026
Comment thread packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts Outdated
Comment thread packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts Outdated
Co-authored-by: Kazuho Cryer-Shinozuka <malaysia.cryer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK 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.

2 participants