Class: AWSCDK::Batch::CfnComputeEnvironment::LaunchTemplateSpecificationOverrideProperty

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

Overview

An object that represents a launch template to use in place of the default launch template.

You must specify either the launch template ID or launch template name in the request, but not both.

If security groups are specified using both the security_group_ids parameter of CreateComputeEnvironment and the launch template, the values in the security_group_ids parameter of CreateComputeEnvironment will be used.

You can define up to ten (10) overrides for each compute environment.

This object isn't applicable to jobs that are running on Fargate resources. > To unset all override templates for a compute environment, you can pass an empty array to the UpdateComputeEnvironment.overrides parameter, or not include the overrides parameter when submitting the UpdateComputeEnvironment API operation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(launch_template_id: nil, launch_template_name: nil, target_instance_types: nil, userdata_type: nil, version: nil) ⇒ LaunchTemplateSpecificationOverrideProperty

Returns a new instance of LaunchTemplateSpecificationOverrideProperty.

Parameters:

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

    The ID of the launch template.

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

    The name of the launch template.

  • target_instance_types (Array<String>, nil) (defaults to: nil)

    The instance type or family that this override launch template should be applied to.

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

    The EKS node initialization process to use.

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

    The version number of the launch template, $Default , or $Latest .



1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
# File 'batch/cfn_compute_environment.rb', line 1203

def initialize(launch_template_id: nil, launch_template_name: nil, target_instance_types: nil, userdata_type: nil, version: nil)
  @launch_template_id = launch_template_id
  Jsii::Type.check_type(@launch_template_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "launchTemplateId") unless @launch_template_id.nil?
  @launch_template_name = launch_template_name
  Jsii::Type.check_type(@launch_template_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "launchTemplateName") unless @launch_template_name.nil?
  @target_instance_types = target_instance_types
  Jsii::Type.check_type(@target_instance_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "targetInstanceTypes") unless @target_instance_types.nil?
  @userdata_type = userdata_type
  Jsii::Type.check_type(@userdata_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "userdataType") unless @userdata_type.nil?
  @version = version
  Jsii::Type.check_type(@version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "version") unless @version.nil?
end

Instance Attribute Details

#launch_template_idString? (readonly)

The ID of the launch template.

Note: If you specify the launch_template_id you can't specify the launch_template_name as well.



1222
1223
1224
# File 'batch/cfn_compute_environment.rb', line 1222

def launch_template_id
  @launch_template_id
end

#launch_template_nameString? (readonly)

The name of the launch template.

Note: If you specify the launch_template_name you can't specify the launch_template_id as well.



1229
1230
1231
# File 'batch/cfn_compute_environment.rb', line 1229

def launch_template_name
  @launch_template_name
end

#target_instance_typesArray<String>? (readonly)

The instance type or family that this override launch template should be applied to.

This parameter is required when defining a launch template override.

Information included in this parameter must meet the following requirements:

  • Must be a valid Amazon EC2 instance type or family.
  • The following AWS Batch InstanceTypes are not allowed: optimal , default_x86_64 , and default_arm64 .
  • target_instance_types can target only instance types and families that are included within the ComputeResource.instanceTypes set. target_instance_types doesn't need to include all of the instances from the instance_type set, but at least a subset. For example, if ComputeResource.instanceTypes includes [m5, g5] , target_instance_types can include [m5.2xlarge] and [m5.large] but not [c5.large] .
  • target_instance_types included within the same launch template override or across launch template overrides can't overlap for the same compute environment. For example, you can't define one launch template override to target an instance family and another define an instance type within this same family.


1243
1244
1245
# File 'batch/cfn_compute_environment.rb', line 1243

def target_instance_types
  @target_instance_types
end

#userdata_typeString? (readonly)

The EKS node initialization process to use.

You only need to specify this value if you are using a custom AMI. The default value is EKS_BOOTSTRAP_SH . If imageType is a custom AMI based on EKS_AL2023 or EKS_AL2023_NVIDIA then you must choose EKS_NODEADM .



1250
1251
1252
# File 'batch/cfn_compute_environment.rb', line 1250

def userdata_type
  @userdata_type
end

#versionString? (readonly)

The version number of the launch template, $Default , or $Latest .

If the value is $Default , the default version of the launch template is used. If the value is $Latest , the latest version of the launch template is used.

If the AMI ID that's used in a compute environment is from the launch template, the AMI isn't changed when the compute environment is updated. It's only changed if the update_to_latest_image_version parameter for the compute environment is set to true . During an infrastructure update, if either $Default or $Latest is specified, AWS Batch re-evaluates the launch template version, and it might use a different version of the launch template. This is the case even if the launch template isn't specified in the update. When updating a compute environment, changing the launch template requires an infrastructure update of the compute environment. For more information, see Updating compute environments in the AWS Batch User Guide .

Default: $Default

Latest: $Latest



1263
1264
1265
# File 'batch/cfn_compute_environment.rb', line 1263

def version
  @version
end

Class Method Details

.jsii_propertiesObject



1265
1266
1267
1268
1269
1270
1271
1272
1273
# File 'batch/cfn_compute_environment.rb', line 1265

def self.jsii_properties
  {
    :launch_template_id => "launchTemplateId",
    :launch_template_name => "launchTemplateName",
    :target_instance_types => "targetInstanceTypes",
    :userdata_type => "userdataType",
    :version => "version",
  }
end

Instance Method Details

#to_jsiiObject



1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
# File 'batch/cfn_compute_environment.rb', line 1275

def to_jsii
  result = {}
  result.merge!({
    "launchTemplateId" => @launch_template_id,
    "launchTemplateName" => @launch_template_name,
    "targetInstanceTypes" => @target_instance_types,
    "userdataType" => @userdata_type,
    "version" => @version,
  })
  result.compact
end