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
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
-
If you are not using a launch template or launch template overrides then change Ec2Configuration.ImageType to
ECS_AL2023
(orECS_AL2023_NVIDIA
when using GPU instances) and then run UpdateComputeEnvironment. -
If you specify an Ec2Configuration.ImageIdOverride then Ec2Configuration.ImageType must match the AMI type specified in Ec2Configuration.ImageIdOverride.
If you mismatch
ImageIdOverride
andImageType
then the compute environment may not function properly.
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 theEc2Configuration
fromECS_AL2
toECS_AL2023
(orECS_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 theImageType
setting.
Migration considerations
When migrating from Amazon Linux 2 to Amazon Linux 2023, consider the following:
-
Package management – Amazon Linux 2023 uses
dnf
instead ofyum
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.