EfsVolume

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

Bases: EcsVolume

A Volume that uses an AWS Elastic File System (EFS);

this volume can grow and shrink as needed

ExampleMetadata:

fixture=_generated

Example:

# 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_efs as efs

# file_system: efs.FileSystem

efs_volume = batch.EfsVolume(
    container_path="containerPath",
    file_system=file_system,
    name="name",

    # the properties below are optional
    access_point_id="accessPointId",
    enable_transit_encryption=False,
    readonly=False,
    root_directory="rootDirectory",
    transit_encryption_port=123,
    use_job_role=False
)
Parameters:
  • 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

  • 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

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 that this volume will be mounted to.

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

Whether or not the container has readonly access to this 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

Static Methods

classmethod efs(*, file_system, access_point_id=None, enable_transit_encryption=None, root_directory=None, transit_encryption_port=None, use_job_role=None, container_path, name, readonly=None)

Creates a Volume that uses an AWS Elastic File System (EFS);

this volume can grow and shrink as needed

Parameters:
  • 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

  • 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

See:

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

Return type:

EfsVolume

classmethod host(*, host_path=None, container_path, name, readonly=None)

Creates a Host volume.

This volume will persist on the host at the specified hostPath. If the hostPath is not specified, Docker will choose the host path. In this case, the data may not persist after the containers that use it stop running.

Parameters:
  • host_path (Optional[str]) – The path on the host machine this container will have access to. Default: - Docker will choose the host path. The data may not persist after the containers that use it stop running.

  • 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

Return type:

HostVolume

classmethod is_efs_volume(x)

Returns true if x is an EfsVolume, false otherwise.

Parameters:

x (Any) –

Return type:

bool