HostVolume

class aws_cdk.aws_batch.HostVolume(*, host_path=None, container_path, name, readonly=None)

Bases: EcsVolume

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.

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

host_volume = batch.HostVolume(
    container_path="containerPath",
    name="name",

    # the properties below are optional
    host_path="hostPath",
    readonly=False
)
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

Attributes

container_path

The path on the container that this volume will be mounted to.

host_path

The path on the host machine this container will have access to.

name

The name of this volume.

readonly

Whether or not the container has readonly access to this volume.

Default:

false

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_host_volume(x)

returns true if x is a HostVolume, false otherwise.

Parameters:

x (Any) –

Return type:

bool