Skip to content

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

Open
aws-joelherd wants to merge 1 commit intoaws:mainfrom
aws-joelherd:feat/add-al2023-default
Open

feat(batch): add AL2023 image types and default to AL2023 (under feature flag)#37539
aws-joelherd wants to merge 1 commit intoaws:mainfrom
aws-joelherd:feat/add-al2023-default

Conversation

@aws-joelherd
Copy link
Copy Markdown

@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

…ure flag)

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.

Closes aws#35839, closes aws#37205
@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.

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.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@aws-joelherd
Copy link
Copy Markdown
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
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/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.

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

2 participants