EksVolume

class aws_cdk.aws_batch.EksVolume(*, name, mount_path=None, readonly=None)

Bases: object

A Volume that can be mounted to a container supported by EKS.

ExampleMetadata:

infused

Example:

job_defn = batch.EksJobDefinition(self, "eksf2",
    container=batch.EksContainerDefinition(self, "container",
        image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"),
        volumes=[batch.EksVolume.empty_dir(
            name="myEmptyDirVolume",
            mount_path="/mount/path",
            medium=batch.EmptyDirMediumType.MEMORY,
            readonly=True,
            size_limit=cdk.Size.mebibytes(2048)
        )]
    )
)
Parameters:
  • name (str) – The name of this volume. The name must be a valid DNS subdomain name.

  • mount_path (Optional[str]) – The path on the container where the volume is mounted. Default: - the volume is not mounted

  • readonly (Optional[bool]) – If specified, the container has readonly access to the volume. Otherwise, the container has read/write access. Default: false

Attributes

container_path

The path on the container where the container is mounted.

Default:
  • the container is not mounted

name

The name of this volume.

The name must be a valid DNS subdomain name.

See:

https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names

readonly

If specified, the container has readonly access to the volume.

Otherwise, the container has read/write access.

Default:

false

Static Methods

classmethod empty_dir(*, medium=None, size_limit=None, name, mount_path=None, readonly=None)

Creates a Kubernetes EmptyDir volume.

Parameters:
  • medium (Optional[EmptyDirMediumType]) – The storage type to use for this Volume. Default: EmptyDirMediumType.DISK

  • size_limit (Optional[Size]) – The maximum size for this Volume. Default: - no size limit

  • name (str) – The name of this volume. The name must be a valid DNS subdomain name.

  • mount_path (Optional[str]) – The path on the container where the volume is mounted. Default: - the volume is not mounted

  • readonly (Optional[bool]) – If specified, the container has readonly access to the volume. Otherwise, the container has read/write access. Default: false

See:

https://kubernetes.io/docs/concepts/storage/volumes/#emptydir

Return type:

EmptyDirVolume

classmethod host_path(*, host_path, name, mount_path=None, readonly=None)

Creates a Kubernetes HostPath volume.

Parameters:
  • host_path (str) – The path of the file or directory on the host to mount into containers on the pod. Note: HothPath Volumes present many security risks, and should be avoided when possible.

  • name (str) – The name of this volume. The name must be a valid DNS subdomain name.

  • mount_path (Optional[str]) – The path on the container where the volume is mounted. Default: - the volume is not mounted

  • readonly (Optional[bool]) – If specified, the container has readonly access to the volume. Otherwise, the container has read/write access. Default: false

See:

https://kubernetes.io/docs/concepts/storage/volumes/#hostpath

Return type:

HostPathVolume

classmethod secret(*, secret_name, optional=None, name, mount_path=None, readonly=None)

Creates a Kubernetes Secret volume.

Parameters:
  • secret_name (str) – The name of the secret. Must be a valid DNS subdomain name.

  • optional (Optional[bool]) – Specifies whether the secret or the secret’s keys must be defined. Default: true

  • name (str) – The name of this volume. The name must be a valid DNS subdomain name.

  • mount_path (Optional[str]) – The path on the container where the volume is mounted. Default: - the volume is not mounted

  • readonly (Optional[bool]) – If specified, the container has readonly access to the volume. Otherwise, the container has read/write access. Default: false

See:

https://kubernetes.io/docs/concepts/storage/volumes/#secret

Return type:

SecretPathVolume