Skip to content

feat(batch): add AL2023 image types and default to AL2023 (under feature flag)#37539

Merged
mergify[bot] merged 4 commits intoaws:mainfrom
aws-joelherd:feat/add-al2023-default
Apr 9, 2026
Merged

feat(batch): add AL2023 image types and default to AL2023 (under feature flag)#37539
mergify[bot] merged 4 commits intoaws:mainfrom
aws-joelherd:feat/add-al2023-default

Conversation

@aws-joelherd
Copy link
Copy Markdown
Contributor

@aws-joelherd aws-joelherd commented Apr 7, 2026

Add missing enum values for AWS Batch Ec2Configuration:

  • EcsMachineImageType.ECS_AL2023_NVIDIA
  • EksMachineImageType.EKS_AL2023
  • EksMachineImageType.EKS_AL2023_NVIDIA

Introduce feature flag @aws-cdk/aws-batch:defaultToAL2023 that switches the default imageType from AL2 to AL2023 for both ECS and EKS compute environments. Amazon Linux 2 has reached EOL for EKS (Nov 2025) and reaches EOL for ECS in June 2026.

For EKS compute environments with a launch template, automatically set userdataType to EKS_NODEADM when an AL2023 image type is resolved, as required by the AWS Batch API to ensure nodes join the cluster.

Update A1 instance validation to also reject ECS_AL2023_NVIDIA and to correctly resolve the feature-flag-defaulted imageType.

Issue # (if applicable)

Closes #35839, closes #37205.

Reason for this change

Amazon Linux 2 has reached EOL for EKS (Nov 2025) and reaches EOL for ECS
in June 2026. The AWS Batch service already defaults to AL2023 for newly
created compute environments, but CDK still hardcodes ECS_AL2 / EKS_AL2
when users don't specify an imageType.

Additionally, the ECS_AL2023_NVIDIA, EKS_AL2023, and EKS_AL2023_NVIDIA
image types supported by the Batch API were missing from the CDK enum definitions.

Related public documentation:

Description of changes

  • Added EcsMachineImageType.ECS_AL2023_NVIDIA, EksMachineImageType.EKS_AL2023,
    and EksMachineImageType.EKS_AL2023_NVIDIA
  • Introduced feature flag @aws-cdk/aws-batch:defaultToAL2023 that switches the
    default imageType from AL2 to AL2023 for both ECS and EKS compute environments
  • For EKS compute environments with a launch template, automatically sets
    userdataType to EKS_NODEADM when an AL2023 image type is resolved, as
    required by the AWS Batch API to ensure nodes join the cluster
  • Updated A1 instance validation to also reject ECS_AL2023_NVIDIA and to
    correctly resolve the feature-flag-defaulted imageType

Describe any new or updated permissions being added

None.

Description of how you validated changes

Unit tests cover all new enum values, feature flag on/off for both ECS and EKS,
userdataType behavior with launch templates (including the critical scenario
where the feature flag defaults to AL2023 with a launch template present), and
A1 instance validation. Build passes with 0 errors. 103 batch tests pass,
118 cx-api tests pass.

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team April 7, 2026 00:22
@github-actions github-actions Bot added 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 labels Apr 7, 2026
@aws-joelherd aws-joelherd changed the title feat(batch): add AL2023 image types and default to AL2023 feat(batch): add AL2023 image types and default to AL2023 (under feature flag) Apr 7, 2026
Copy link
Copy Markdown
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-joelherd
Copy link
Copy Markdown
Contributor Author

aws-joelherd commented Apr 7, 2026

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

Exemption Request

This change adds new enum values and a feature flag that only affects the default imageType value in the synthesized CloudFormation template. The feature flag is fully covered by unit tests (flag on/off for both ECS and EKS, userdataType with launch templates, A1 validation). The existing integration test for managed compute environments already covers the ECS_AL2023 image type. No new CloudFormation resource types are introduced.

@aws-cdk-automation aws-cdk-automation added pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Apr 7, 2026
Comment thread packages/aws-cdk-lib/aws-batch/lib/managed-compute-environment.ts
Comment thread packages/aws-cdk-lib/aws-batch/lib/managed-compute-environment.ts Outdated
Comment thread packages/aws-cdk-lib/aws-batch/lib/managed-compute-environment.ts
@vishaalmehrishi vishaalmehrishi added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Apr 9, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 9, 2026 09:19

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

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 9, 2026

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
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 9, 2026

Merge Queue Status

  • Entered queue2026-04-09 09:20 UTC · Rule: default-squash
  • Checks started · in-place
  • 🚫 Left the queue2026-04-09 10:48 UTC · at e2b55986e2fe28183be6b2e16d6b73eda669fa34

This pull request spent 1 hour 27 minutes 41 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/spec-update.yml without workflows permission

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 9, 2026

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
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 9, 2026

Merge Queue Status

  • Entered queue2026-04-09 14:54 UTC · Rule: default-squash
  • Checks passed · in-place
  • Merged2026-04-09 16:14 UTC · at 1eff03af131ac22a2b95712b7f0f67556f4e5513

This pull request spent 1 hour 20 minutes 10 seconds in the queue, including 1 hour 19 minutes 51 seconds running CI.

Required conditions to merge

@mergify mergify Bot temporarily deployed to automation April 9, 2026 14:54 Inactive
@mergify mergify Bot temporarily deployed to automation April 9, 2026 14:55 Inactive
@mergify mergify Bot temporarily deployed to test-pipeline April 9, 2026 14:55 Inactive
@mergify mergify Bot temporarily deployed to automation April 9, 2026 15:48 Inactive
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

➡️ PR build request submitted to test-main-pipeline ⬅️

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 9, 2026

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 6c1251c into aws:main Apr 9, 2026
19 of 20 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 9, 2026

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 Apr 9, 2026
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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-batch): Switch to AL2023 in the default AMI for EC2 compute environments (aws-batch): AWS Batch Compute Environment For AL2023

3 participants