# EmptyDirVolumeOptions

Options for a Kubernetes EmptyDir volume.

Extends: [EksVolumeOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EksVolumeOptions.html)
Used as props by: [EmptyDirVolume](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EmptyDirVolume.html)
Used as argument in: [EksVolume.emptyDir](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EksVolume.html#emptydir)

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

## Example

TypeScript:

```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),
    })],
  }),
});
```

Python:

```python
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)
        )]
    )
)
```

Java:

```java
EksJobDefinition jobDefn = EksJobDefinition.Builder.create(this, "eksf2")
        .container(EksContainerDefinition.Builder.create(this, "container")
                .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
                .volumes(List.of(EksVolume.emptyDir(EmptyDirVolumeOptions.builder()
                        .name("myEmptyDirVolume")
                        .mountPath("/mount/path")
                        .medium(EmptyDirMediumType.MEMORY)
                        .readonly(true)
                        .sizeLimit(Size.mebibytes(2048))
                        .build())))
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var jobDefn = new EksJobDefinition(this, "eksf2", new EksJobDefinitionProps {
    Container = new EksContainerDefinition(this, "container", new EksContainerDefinitionProps {
        Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
        Volumes = new [] { EksVolume.EmptyDir(new EmptyDirVolumeOptions {
            Name = "myEmptyDirVolume",
            MountPath = "/mount/path",
            Medium = EmptyDirMediumType.MEMORY,
            Readonly = true,
            SizeLimit = Size.Mebibytes(2048)
        }) }
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
jobDefn := batch.NewEksJobDefinition(this, jsii.String("eksf2"), &EksJobDefinitionProps{
	Container: batch.NewEksContainerDefinition(this, jsii.String("container"), &EksContainerDefinitionProps{
		Image: ecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample")),
		Volumes: []EksVolume{
			batch.EksVolume_EmptyDir(&EmptyDirVolumeOptions{
				Name: jsii.String("myEmptyDirVolume"),
				MountPath: jsii.String("/mount/path"),
				Medium: batch.EmptyDirMediumType_MEMORY,
				Readonly: jsii.Boolean(true),
				SizeLimit: cdk.Size_Mebibytes(jsii.Number(2048)),
			}),
		},
	}),
})
```

## Properties

- `medium`: [EmptyDirMediumType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_batch.EmptyDirMediumType.html) = `EmptyDirMediumType.DISK` — The storage type to use for this Volume.

- `mountPath`: string — The path on the container where the volume is mounted.

  **Default:** the volume is not 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.

- `sizeLimit`: [Size](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Size.html) — The maximum size for this Volume.

  **Default:** no size limit
