# HostPathVolumeOptions

Options for a kubernetes HostPath volume.

Extends: HostPathVolumeOptions
Extends: EksVolumeOptions
Used as props by: HostPathVolume

- 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#L819)
- Type last changed: v2.96.0 · 13 Sep 2023

## Example

```ts
declare const jobDefn: batch.EksJobDefinition;
jobDefn.container.addVolume(batch.EksVolume.emptyDir({
  name: 'emptyDir',
  mountPath: '/Volumes/emptyDir',
}));
jobDefn.container.addVolume(batch.EksVolume.hostPath({
  name: 'hostPath',
  hostPath: '/sys',
  mountPath: '/Volumes/hostPath',
}));
jobDefn.container.addVolume(batch.EksVolume.secret({
  name: 'secret',
  optional: true,
  mountPath: '/Volumes/secret',
  secretName: 'mySecret',
}));
```

## Properties

- `hostPath`: string (required) — 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.

- `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.
