How to migrate from ECS AL2 to ECS AL2023 - Amazon Batch
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

How to migrate from ECS AL2 to ECS AL2023

AL2023 is a Linux-based operating system designed to provide a secure, stable, and high-performance environment for your cloud applications. For more information about the differences between AL2 and AL2023 see Compare Amazon Linux 2023 and Amazon Linux 2 in the Amazon Linux 2023 User Guide.

Starting in January 2026, Amazon Batch will change the default AMI for new Amazon ECS compute environments from Amazon Linux 2 to Amazon Linux 2023 because Amazon will be ending support for Amazon Linux 2. The default AMI is used when you don't specify a value for the imageType.Ec2Configuration field when creating a new compute environment. We recommend migrating Amazon Batch Amazon ECS compute environments to Amazon Linux 2023 to maintain optimal performance and security.

Depending on how your compute environment is configured you can use one of the following upgrade paths from AL2 to AL2023.

Upgrade using Ec2Configuration.ImageType
Upgrade using launch templates
  • If you use a launch template that specifies an AMI based on ECS_AL2023, ensure your launch template is compatible with Amazon Linux 2023. For information about changes in Amazon Linux 2023 for Amazon ECS-optimized AMI, see Migrating from an Amazon Linux 2 to an Amazon Linux 2023 Amazon ECS-optimized AMI in the Amazon ECS User Guide.

  • For AL2023 AMIs, verify that any custom user data or initialization scripts are compatible with the AL2023 environment and package management system.

Upgrade using Amazon CloudFormation
  • If you use Amazon CloudFormation to manage your compute environments, update your template to change the ImageType property in the Ec2Configuration from ECS_AL2 to ECS_AL2023 (or ECS_AL2023_NVIDIA when using GPU instances):

    ComputeEnvironment: Type: AWS::Batch::ComputeEnvironment Properties: ComputeResources: Ec2Configuration: - ImageType: ECS_AL2023

    Then update your Amazon CloudFormation stack to apply the changes.

  • If your Amazon CloudFormation template specifies a custom AMI using ImageIdOverride, ensure the AMI ID corresponds to an AL2023-based AMI and matches the ImageType setting.

Migration considerations

When migrating from Amazon Linux 2 to Amazon Linux 2023, consider the following:

  • Package management – Amazon Linux 2023 uses dnf instead of yum for package management.

  • System services – Some system services and their configurations may differ between AL2 and AL2023.

  • Container runtime – Both AL2 and AL2023 support Docker, but AL2023 may have different default configurations.

  • Security – AL2023 includes enhanced security features and may require updates to security-related configurations.

  • Instance Metadata Service Version 2 (IMDSv2) – IMDSv2 is a session-oriented service that requires token-based authentication to access EC2 instance metadata, providing enhanced security. For more information about IMDS see and How Instance Metadata Service Version 2 works in the Amazon EC2 User Guide.

For a comprehensive list of changes and migration considerations, see Migrating from an Amazon Linux 2 to an Amazon Linux 2023 Amazon ECS-optimized AMI in the Amazon ECS User Guide.