# EksVolume

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

Extends: EksVolume
Superclass of: EmptyDirVolume, HostPathVolume, SecretPathVolume

- Source: [`aws-batch/lib/eks-container-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-batch/lib/eks-container-definition.ts#L680)
- Type last changed: v2.96.0 · 13 Sep 2023

## Example

```ts
const jobDefn = new batch.EksJobDefinition(this, 'eksf2', {
  container: new batch.EksContainerDefinition(this, 'container', {
    image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
    volumes: [batch.EksVolume.emptyDir({
      name: 'myEmptyDirVolume',
      mountPath: '/mount/path',
      medium: batch.EmptyDirMediumType.MEMORY,
      readonly: true,
      sizeLimit: cdk.Size.mebibytes(2048),
    })],
  }),
});
```

## Initializer

```ts
new EksVolume(options: EksVolumeOptions)
```

## Properties

- `containerPath`: string = the container is not mounted — The path on the container where the container is mounted.

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

  The name must be a valid DNS subdomain name.

- `readonly`: boolean = false — If specified, the container has readonly access to the volume.

  Otherwise, the container has read/write access.

## Methods

- `emptyDir(options: EmptyDirVolumeOptions): EmptyDirVolume` (static) — Creates a Kubernetes EmptyDir volume.

- `hostPath(options: HostPathVolumeOptions): HostPathVolume` (static) — Creates a Kubernetes HostPath volume.

- `secret(options: SecretPathVolumeOptions): SecretPathVolume` (static) — Creates a Kubernetes Secret volume.
