Skip to content
v2.274.0

HostPathVolume Class ​

A Kubernetes HostPath volume.

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,
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_batch as batch

host_path_volume = batch.HostPathVolume(
    host_path="hostPath",
    name="name",

    # the properties below are optional
    mount_path="mountPath",
    readonly=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.batch.*;

HostPathVolume hostPathVolume = HostPathVolume.Builder.create()
        .hostPath("hostPath")
        .name("name")

        // the properties below are optional
        .mountPath("mountPath")
        .readonly(false)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Batch;

var hostPathVolume = new HostPathVolume(new HostPathVolumeOptions {
    HostPath = "hostPath",
    Name = "name",

    // the properties below are optional
    MountPath = "mountPath",
    Readonly = false
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

hostPathVolume := awscdk.Aws_batch.NewHostPathVolume(&HostPathVolumeOptions{
	HostPath: jsii.String("hostPath"),
	Name: jsii.String("name"),

	// the properties below are optional
	MountPath: jsii.String("mountPath"),
	Readonly: jsii.Boolean(false),
})

Initializer ​

ts
new HostPathVolume(options: HostPathVolumeOptions)
python
HostPathVolume(options: HostPathVolumeOptions)
java
new HostPathVolume(HostPathVolumeOptions options)
csharp
new HostPathVolume(HostPathVolumeOptions options)
go
NewHostPathVolume(Options HostPathVolumeOptions)

Properties ​

containerPathstringcontainer_pathstrcontainerPathStringContainerPathstringContainerPath*string= the container is not mounted#
The path on the container where the container is mounted.
namestringnamestrnameStringNamestringName*stringrequired#
The name of this volume.

The name must be a valid DNS subdomain name.

pathstringpathstrpathStringPathstringPath*stringrequired#
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.

readonlybooleanreadonlyboolreadonlyBooleanReadonlyboolReadonly*bool= false#
If specified, the container has readonly access to the volume.

Otherwise, the container has read/write access.

Methods ​

emptyDir(options: EmptyDirVolumeOptions): EmptyDirVolume@staticmethod def empty_dir(options: EmptyDirVolumeOptions) -> EmptyDirVolumepublic static EmptyDirVolume emptyDir(EmptyDirVolumeOptions options)public static EmptyDirVolume EmptyDir(EmptyDirVolumeOptions options)func EmptyDir(Options EmptyDirVolumeOptions) EmptyDirVolumestatic#
Creates a Kubernetes EmptyDir volume.
hostPath(options: HostPathVolumeOptions): HostPathVolume // chainable@staticmethod def host_path(options: HostPathVolumeOptions) -> HostPathVolumepublic static HostPathVolume hostPath(HostPathVolumeOptions options)public static HostPathVolume HostPath(HostPathVolumeOptions options)func HostPath(Options HostPathVolumeOptions) HostPathVolumestatic#
Creates a Kubernetes HostPath volume.
isHostPathVolume(x: any): boolean@staticmethod def is_host_path_volume(x: Any) -> boolpublic static Boolean isHostPathVolume(Object x)public static bool IsHostPathVolume(object x)func IsHostPathVolume(X interface{}) *boolstatic#
returns `true` if `x` is a HostPathVolume, `false` otherwise.
secret(options: SecretPathVolumeOptions): SecretPathVolume@staticmethod def secret(options: SecretPathVolumeOptions) -> SecretPathVolumepublic static SecretPathVolume secret(SecretPathVolumeOptions options)public static SecretPathVolume Secret(SecretPathVolumeOptions options)func Secret(Options SecretPathVolumeOptions) SecretPathVolumestatic#
Creates a Kubernetes Secret volume.