Class EcsVolume
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.batch.EcsVolume
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
EfsVolume,HostVolume
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:33.345Z")
@Stability(Stable)
public abstract class EcsVolume
extends software.amazon.jsii.JsiiObject
Represents a Volume that can be mounted to a container that uses ECS.
Example:
IFileSystem myFileSystem;
Role myJobRole;
myFileSystem.grantRead(myJobRole);
EcsJobDefinition jobDefn = EcsJobDefinition.Builder.create(this, "JobDefn")
.container(EcsEc2ContainerDefinition.Builder.create(this, "containerDefn")
.image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"))
.memory(Size.mebibytes(2048))
.cpu(256)
.volumes(List.of(EcsVolume.efs(EfsVolumeOptions.builder()
.name("myVolume")
.fileSystem(myFileSystem)
.containerPath("/Volumes/myVolume")
.useJobRole(true)
.build())))
.jobRole(myJobRole)
.build())
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEcsVolume(EcsVolumeOptions options) protectedEcsVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedEcsVolume(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic EfsVolumeefs(EfsVolumeOptions options) Creates a Volume that uses an AWS Elastic File System (EFS);The path on the container that this volume will be mounted to.getName()The name of this volume.Whether or not the container has readonly access to this volume.static HostVolumehost(HostVolumeOptions options) Creates a Host volume.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
EcsVolume
protected EcsVolume(software.amazon.jsii.JsiiObjectRef objRef) -
EcsVolume
protected EcsVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EcsVolume
- Parameters:
options- This parameter is required.
-
-
Method Details
-
efs
Creates a Volume that uses an AWS Elastic File System (EFS);this volume can grow and shrink as needed
- Parameters:
options- This parameter is required.- See Also:
-
host
Creates a Host volume.This volume will persist on the host at the specified
hostPath. If thehostPathis not specified, Docker will choose the host path. In this case, the data may not persist after the containers that use it stop running.- Parameters:
options- This parameter is required.
-
getContainerPath
The path on the container that this volume will be mounted to. -
getName
The name of this volume. -
getReadonly
Whether or not the container has readonly access to this volume.Default: false
-