# HostPathVolume

A Kubernetes HostPath volume.

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

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_batch as batch } from 'aws-cdk-lib';
const hostPathVolume = new batch.HostPathVolume({
  hostPath: 'hostPath',
  name: 'name',

  // the properties below are optional
  mountPath: 'mountPath',
  readonly: false,
});
```

## Initializer

```ts
new HostPathVolume(options: HostPathVolumeOptions)
```

## Properties

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

  **Default:** the container is not mounted

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

  The name must be a valid DNS subdomain name.

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

- `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 // chainable` (static) — Creates a Kubernetes HostPath volume.

- `isHostPathVolume(x: any): boolean` (static) — returns `true` if `x` is a HostPathVolume, `false` otherwise.

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