Class: AWSCDK::Batch::CfnComputeEnvironment::EC2ConfigurationObjectProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/cfn_compute_environment.rb

Overview

Provides information used to select Amazon Machine Images (AMIs) for instances in the compute environment.

If Ec2Configuration isn't specified, the default is ECS_AL2 ( Amazon Linux 2 ).

This object isn't applicable to jobs that are running on Fargate resources.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_type:, batch_image_status: nil, image_id_override: nil, image_kubernetes_version: nil) ⇒ EC2ConfigurationObjectProperty

Returns a new instance of EC2ConfigurationObjectProperty.

Parameters:

  • image_type (String)

    The image type to match with the instance type to select an AMI.

  • batch_image_status (String, nil) (defaults to: nil)
  • image_id_override (String, nil) (defaults to: nil)

    The AMI ID used for instances launched in the compute environment that match the image type.

  • image_kubernetes_version (String, nil) (defaults to: nil)

    The Kubernetes version for the compute environment.



1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'batch/cfn_compute_environment.rb', line 1048

def initialize(image_type:, batch_image_status: nil, image_id_override: nil, image_kubernetes_version: nil)
  @image_type = image_type
  Jsii::Type.check_type(@image_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageType")
  @batch_image_status = batch_image_status
  Jsii::Type.check_type(@batch_image_status, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "batchImageStatus") unless @batch_image_status.nil?
  @image_id_override = image_id_override
  Jsii::Type.check_type(@image_id_override, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageIdOverride") unless @image_id_override.nil?
  @image_kubernetes_version = image_kubernetes_version
  Jsii::Type.check_type(@image_kubernetes_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageKubernetesVersion") unless @image_kubernetes_version.nil?
end

Instance Attribute Details

#batch_image_statusString? (readonly)



1096
1097
1098
# File 'batch/cfn_compute_environment.rb', line 1096

def batch_image_status
  @batch_image_status
end

#image_id_overrideString? (readonly)

The AMI ID used for instances launched in the compute environment that match the image type.

This setting overrides the image_id set in the compute_resource object.

The AMI that you choose for a compute environment must match the architecture of the instance types that you intend to use for that compute environment. For example, if your compute environment uses A1 instance types, the compute resource AMI that you choose must support ARM instances. Amazon ECS vends both x86 and ARM versions of the Amazon ECS-optimized Amazon Linux 2 AMI. For more information, see Amazon ECS-optimized Amazon Linux 2 AMI in the Amazon Elastic Container Service Developer Guide .



1105
1106
1107
# File 'batch/cfn_compute_environment.rb', line 1105

def image_id_override
  @image_id_override
end

#image_kubernetes_versionString? (readonly)

The Kubernetes version for the compute environment.

If you don't specify a value, the latest version that AWS Batch supports is used.



1112
1113
1114
# File 'batch/cfn_compute_environment.rb', line 1112

def image_kubernetes_version
  @image_kubernetes_version
end

#image_typeString (readonly)

The image type to match with the instance type to select an AMI.

The supported values are different for ECS and EKS resources.

  • ECS - If the image_id_override parameter isn't specified, then a recent Amazon ECS-optimized Amazon Linux 2 AMI ( ECS_AL2 ) is used. If a new image type is specified in an update, but neither an image_id nor a image_id_override parameter is specified, then the latest Amazon ECS optimized AMI for that image type that's supported by AWS Batch is used.

AWS will end support for Amazon ECS optimized AL2-optimized and AL2-accelerated AMIs. Starting in January 2026, AWS Batch will change the default AMI for new Amazon ECS compute environments from Amazon Linux 2 to Amazon Linux 2023. We recommend migrating AWS Batch Amazon ECS compute environments to Amazon Linux 2023 to maintain optimal performance and security. For more information on upgrading from AL2 to AL2023, see How to migrate from ECS AL2 to ECS AL2023 in the AWS Batch User Guide .

  • ECS_AL2 - Amazon Linux 2 : Default for all non-GPU instance families.
  • ECS_AL2_NVIDIA - Amazon Linux 2 (GPU) : Default for all GPU instance families (for example P4 and G4 ) and can be used for all non AWS Graviton-based instance types.
  • ECS_AL2023 - Amazon Linux 2023 : AWS Batch supports Amazon Linux 2023.

Amazon Linux 2023 does not support A1 instances.

  • ECS_AL2023_NVIDIA - Amazon Linux 2023 (GPU) : For all GPU instance families and can be used for all non AWS Graviton-based instance types.

ECS_AL2023_NVIDIA doesn't support p3 and g3 instance types.

  • EKS - If the image_id_override parameter isn't specified, then a recent Amazon EKS-optimized Amazon Linux 2023 AMI ( EKS_AL2023 ) is used. If a new image type is specified in an update, but neither an image_id nor a image_id_override parameter is specified, then the latest Amazon EKS optimized AMI for that image type that AWS Batch supports is used.

Amazon Linux 2023 AMIs are the default on AWS Batch for Amazon EKS.

AWS will end support for Amazon EKS AL2-optimized and AL2-accelerated AMIs, starting 11/26/25. You can continue using AWS Batch -provided Amazon EKS optimized Amazon Linux 2 AMIs on your Amazon EKS compute environments beyond the 11/26/25 end-of-support date, these compute environments will no longer receive any new software updates, security patches, or bug fixes from AWS . For more information on upgrading from AL2 to AL2023, see How to upgrade from EKS AL2 to EKS AL2023 in the AWS Batch User Guide .

  • EKS_AL2 - Amazon Linux 2 : Used for non-GPU instance families.
  • EKS_AL2_NVIDIA - Amazon Linux 2 (accelerated) : Used for GPU instance families (for example, P4 and G4 ) and can be used for all non AWS Graviton-based instance types.
  • EKS_AL2023 - Amazon Linux 2023 : Default for non-GPU instance families.

Amazon Linux 2023 does not support A1 instances.



1093
1094
1095
# File 'batch/cfn_compute_environment.rb', line 1093

def image_type
  @image_type
end

Class Method Details

.jsii_propertiesObject



1114
1115
1116
1117
1118
1119
1120
1121
# File 'batch/cfn_compute_environment.rb', line 1114

def self.jsii_properties
  {
    :image_type => "imageType",
    :batch_image_status => "batchImageStatus",
    :image_id_override => "imageIdOverride",
    :image_kubernetes_version => "imageKubernetesVersion",
  }
end

Instance Method Details

#to_jsiiObject



1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
# File 'batch/cfn_compute_environment.rb', line 1123

def to_jsii
  result = {}
  result.merge!({
    "imageType" => @image_type,
    "batchImageStatus" => @batch_image_status,
    "imageIdOverride" => @image_id_override,
    "imageKubernetesVersion" => @image_kubernetes_version,
  })
  result.compact
end