# EcsMachineImage

A Batch MachineImage that is compatible with ECS.

- Source: [`aws-batch/lib/managed-compute-environment.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-batch/lib/managed-compute-environment.ts#L385)
- Type last changed: v2.249.0 · 13 Apr 2026

## 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,
};
```

## Properties

- `image`: [IMachineImage](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IMachineImage.html) — The machine image to use.

  **Default:** chosen by batch

- `imageType`: [EcsMachineImageType](/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EcsMachineImageType.html) — 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'.
