Skip to content

fix(ecs): allow ephemeralStorageGiB for Windows Fargate platform version 1.0.0 - #37589

Merged
mergify[bot] merged 12 commits into
aws:mainfrom
rgoltz:37510-ephemeralStorageGiB-Windows
Sep 9, 2026
Merged

mergify[bot] merged 12 commits into
aws:mainfrom
rgoltz:37510-ephemeralStorageGiB-Windows

Conversation

@rgoltz

@rgoltz rgoltz commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #37510.

Reason for this change

FargateService currently throws EphemeralStorageGibFeatureRequires when ephemeralStorageGiB is set and the Fargate platform version is < 1.4.0.

This validation is correct for Linux tasks, but incorrect for Windows tasks: according to the ECS documentation, Windows Fargate supports task ephemeral storage starting with platform version 1.0.0.

Description of changes

  • Added a public getter for TaskDefinition.runtimePlatform so FargateService can determine the task operating system family.
  • Updated FargateService validation to only require platform version >= 1.4.0 for ephemeralStorageGiB on non-Windows (Linux) tasks.
  • Updated the ephemeralStorageGiB documentation to reflect the different minimum platform versions for Linux vs. Windows tasks.
  • Added a unit test verifying that setting ephemeralStorageGiB on a Windows Fargate task definition with platform version 1.0.0 does not fail during synth.

Alternatives considered:

  • Removing the validation entirely (rejected: Linux requires 1.4.0+).
  • Introducing a separate public API just for the OS family (rejected: runtimePlatform already models the required information).

Describe any new or updated permissions being added

None.

Description of how you validated changes

  • Added a unit test in packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-service.test.ts that synthesizes a Windows Fargate service using platformVersion: VERSION1_0 and ephemeralStorageGiB.
  • Existing unit test coverage for the Linux restriction (platform version < 1.4.0) remains unchanged.

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 bug This issue is a bug. effort/small Small work item – less than a day of effort p1 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Apr 13, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team April 13, 2026 20:59

@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)

@rgoltz
rgoltz marked this pull request as draft April 13, 2026 21:52
@rgoltz
rgoltz marked this pull request as draft April 13, 2026 21:52
@aws-cdk-automation
aws-cdk-automation dismissed their stale review April 14, 2026 04:58

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

@rgoltz

rgoltz commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

Added an integ snapshot test to provide coverage for this behavior (as best as possible) and to guard against regressions.

  • CDK does not fail at construct validation / synth when ephemeralStorageGiB is set for a Windows Fargate task while using platformVersion: 1.0.0.
  • The synthesized template includes the expected CFN properties:
    • AWS::ECS::TaskDefinition.EphemeralStorage.SizeInGiB
    • AWS::ECS::TaskDefinition.RuntimePlatform (Windows/X86_64)
    • AWS::ECS::Service.PlatformVersion = 1.0.0 (captured in the snapshot)

It does not attempt to run a Windows task or validate container startup/image pull on Fargate: Start a Windows Image takes many time and could might result in a flakiness/latency to CI. Hence, I uses desiredCount: 0 to keep integ runs stable while still exercising synth + snapshot coverage. I (the integ-runner) successfully created the stack + service in my AWS account.

@rgoltz
rgoltz marked this pull request as ready for review April 14, 2026 05:07

@kumvprat kumvprat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this fix

I left three small, non-blocking suggestions inline (error-message clarity for the tokenized-OS edge case, a note on the public-getter API surface, and a positive template assertion in the unit test).

@kumvprat kumvprat added the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Sep 3, 2026
@kumvprat
kumvprat temporarily deployed to deployment-integ-test September 3, 2026 11:00 — with GitHub Actions Inactive
@maintainer-for-aws

maintainer-for-aws Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Automated review

A maintainer will still review this — treat the notes below as a starting point.

This PR fixes over-restrictive client-side validation in aws-ecs so that Windows Fargate tasks with ephemeralStorageGiB are no longer rejected on platform version 1.0.0, aligning CDK with documented ECS behavior (Linux requires 1.4.0+, Windows requires 1.0.0+). The change narrows the FargateService guard to skip the check for Windows and for unresolved (token) OS families, exposes a new public read-back getter runtimePlatform on TaskDefinition (renaming the backing field to _runtimePlatform), and updates the related doc comments. It is accompanied by two new unit tests (the Windows happy path and the tokenized-OS defer path), a preserved negative test for Linux < 1.4.0, and a new integration test with a synthesized snapshot. The narrowed validation still rejects Linux tasks below 1.4.0, the field rename touches no public surface, and the new getter is a backward-compatible additive change returning an existing public type. No issues found on this change.

🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional


Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.

@rgoltz
rgoltz temporarily deployed to deployment-integ-test September 9, 2026 16:09 — with GitHub Actions Inactive
@kumvprat kumvprat removed the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Sep 9, 2026

@kumvprat kumvprat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!! Thanks for the effort on this PR

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 9, 2026
@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify

mergify Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-09 17:33 UTC · Rule: default-squash · triggered by rule automatic merge
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-09 17:38 UTC · at 855dfeb67c8cba8cd5cc58f6e72e9de36ff92cf3 · squash

This pull request spent 5 minutes in the queue, including 4 minutes 47 seconds running CI.

Required conditions to merge

@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
mergify Bot merged commit 855dfeb into aws:main Sep 9, 2026
41 of 43 checks passed
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 9, 2026

This branch was previously deployed

2 inactive deployments
automation — df0c650e Deployed Sep 9, 2026 by aws-cdk-automation via validate-pr #366916
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ecs): cannot set ephemeralStorageGiB for Windows platform v1.0.0

4 participants