EfsVolumeOptions

class aws_cdk.aws_batch.EfsVolumeOptions(*, container_path, name, readonly=None, file_system, access_point_id=None, enable_transit_encryption=None, root_directory=None, transit_encryption_port=None, use_job_role=None)

Bases: EcsVolumeOptions

Options for configuring an EfsVolume.

Parameters:
  • container_path (str) – the path on the container where this volume is mounted.

  • name (str) – the name of this volume.

  • readonly (Optional[bool]) – if set, the container will have readonly access to the volume. Default: false

  • file_system (IFileSystem) – The EFS File System that supports this volume.

  • access_point_id (Optional[str]) – The Amazon EFS access point ID to use. 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. Default: - no accessPointId

  • enable_transit_encryption (Optional[bool]) – Enables encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server. Default: false

  • root_directory (Optional[str]) – The directory within the Amazon EFS file system to mount as the root directory inside the host. 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. Default: - root of the EFS File System

  • transit_encryption_port (Union[int, float, None]) – The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server. The value must be between 0 and 65,535. Default: - chosen by the EFS Mount Helper

  • use_job_role (Optional[bool]) – 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. Default: false

ExampleMetadata:

infused

Example:

# my_file_system: efs.IFileSystem
# my_job_role: iam.Role

my_file_system.grant_read(my_job_role)

job_defn = batch.EcsJobDefinition(self, "JobDefn",
    container=batch.EcsEc2ContainerDefinition(self, "containerDefn",
        image=ecs.ContainerImage.from_registry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
        memory=cdk.Size.mebibytes(2048),
        cpu=256,
        volumes=[batch.EcsVolume.efs(
            name="myVolume",
            file_system=my_file_system,
            container_path="/Volumes/myVolume",
            use_job_role=True
        )],
        job_role=my_job_role
    )
)

Attributes

access_point_id

The Amazon EFS access point ID to use.

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.

Default:
  • no accessPointId

See:

https://docs.aws.amazon.com/efs/latest/ug/efs-access-points.html

container_path

the path on the container where this volume is mounted.

enable_transit_encryption

Enables encryption for Amazon EFS data in transit between the Amazon ECS host and the Amazon EFS server.

Default:

false

See:

https://docs.aws.amazon.com/efs/latest/ug/encryption-in-transit.html

file_system

The EFS File System that supports this volume.

name

the name of this volume.

readonly

if set, the container will have readonly access to the volume.

Default:

false

root_directory

The directory within the Amazon EFS file system to mount as the root directory inside the host.

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.

Default:
  • root of the EFS File System

transit_encryption_port

The port to use when sending encrypted data between the Amazon ECS host and the Amazon EFS server.

The value must be between 0 and 65,535.

Default:
  • chosen by the EFS Mount Helper

See:

https://docs.aws.amazon.com/efs/latest/ug/efs-mount-helper.html

use_job_role

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.

Default:

false

See:

https://docs.aws.amazon.com/batch/latest/userguide/efs-volumes.html#efs-volume-accesspoints