# EfsVolumeOptions

Options for configuring an EfsVolume.

Extends: EfsVolumeOptions
Extends: EcsVolumeOptions
Used as props by: EfsVolume

- Source: [`aws-batch/lib/ecs-container-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-batch/lib/ecs-container-definition.ts#L180)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

```ts
declare const myFileSystem: efs.IFileSystem;
declare const myJobRole: iam.Role;
myFileSystem.grantRead(myJobRole);

const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
  container: new batch.EcsEc2ContainerDefinition(this, 'containerDefn', {
    image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
    memory: cdk.Size.mebibytes(2048),
    cpu: 256,
    volumes: [batch.EcsVolume.efs({
      name: 'myVolume',
      fileSystem: myFileSystem,
      containerPath: '/Volumes/myVolume',
      useJobRole: true,
    })],
    jobRole: myJobRole,
  }),
});
```

## Properties

- `accessPointId`: string — The Amazon EFS access point ID to use.

  **Default:** no accessPointId

  If an access point is specified, `rootDirectory` must either be omitted or set to `/`
  which enforces the path set on the EFS access point.
  If an access point is used, `enableTransitEncryption` must be `true`.

- `containerPath`: string (required) — the path on the container where this volume is mounted.

- `enableTransitEncryption`: boolean = false — Enables encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server.

- `fileSystem`: [IFileSystemRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_efs.IFileSystemRef.html) (required) — The EFS File System that supports this volume.

- `name`: string (required) — the name of this volume.

- `readonly`: boolean = false — if set, the container will have readonly access to the volume.

- `rootDirectory`: string — The directory within the Amazon EFS file system to mount as the root directory inside the host.

  **Default:** root of the EFS File System

  If this parameter is omitted, the root of the Amazon EFS volume is used instead.
  Specifying `/` has the same effect as omitting this parameter.
  The maximum length is 4,096 characters.

- `transitEncryptionPort`: number — The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server.

  **Default:** chosen by the EFS Mount Helper

  The value must be between 0 and 65,535.

- `useJobRole`: boolean = false — Whether or not to use the AWS Batch job IAM role defined in a job definition when mounting the Amazon EFS file system.

  If specified, `enableTransitEncryption` must be `true`.
