Skip to content
v2.277.0

EcsMachineImage Struct ​

A Batch MachineImage that is compatible with ECS.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_batch as batch } from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const machineImage: ec2.IMachineImage;
const ecsMachineImage: batch.EcsMachineImage = {
  image: machineImage,
  imageType: batch.EcsMachineImageType.ECS_AL2,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_batch as batch
from aws_cdk import aws_ec2 as ec2

# machine_image: ec2.IMachineImage

ecs_machine_image = batch.EcsMachineImage(
    image=machine_image,
    image_type=batch.EcsMachineImageType.ECS_AL2
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.batch.*;
import software.amazon.awscdk.services.ec2.*;

IMachineImage machineImage;

EcsMachineImage ecsMachineImage = EcsMachineImage.builder()
        .image(machineImage)
        .imageType(EcsMachineImageType.ECS_AL2)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Batch;
using Amazon.CDK.AWS.EC2;

IMachineImage machineImage;

var ecsMachineImage = new EcsMachineImage {
    Image = machineImage,
    ImageType = EcsMachineImageType.ECS_AL2
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var machineImage IMachineImage

ecsMachineImage := &EcsMachineImage{
	Image: machineImage,
	ImageType: awscdk.Aws_batch.EcsMachineImageType_ECS_AL2,
}

Properties ​

imageoptionalIMachineImageimageoptionalIMachineImageimageoptionalIMachineImageImageoptionalIMachineImageImageoptionalIMachineImage#
The machine image to use.

Default: chosen by batch

imageTypeoptionalEcsMachineImageTypeimage_typeoptionalEcsMachineImageTypeimageTypeoptionalEcsMachineImageTypeImageTypeoptionalEcsMachineImageTypeImageTypeoptionalEcsMachineImageType#
Tells Batch which instance type to launch this image on.

Default: 'ECS_AL2' for non-gpu instances, 'ECS_AL2_NVIDIA' for gpu instances. If the '@aws-cdk/aws-batch:defaultToAL2023' feature flag is set, 'ECS_AL2023' will be used instead of 'ECS_AL2'.