class EcsVolume
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Batch.EcsVolume |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsbatch#EcsVolume |
Java | software.amazon.awscdk.services.batch.EcsVolume |
Python | aws_cdk.aws_batch.EcsVolume |
TypeScript (source) | aws-cdk-lib » aws_batch » EcsVolume |
Implemented by
Efs
, Host
Represents a Volume that can be mounted to a container that uses ECS.
Example
declare const myFileSystem: efs.IFileSystem;
declare const myJobRole: iam.Role;
myFileSystem.grantRead(myJobRole);
const jobDefn = new batch.EcsJobDefinition(this, 'JobDefn', {
container: new batch.EcsEc2ContainerDefinition(this, 'containerDefn', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/amazonlinux/amazonlinux:latest'),
memory: cdk.Size.mebibytes(2048),
cpu: 256,
volumes: [batch.EcsVolume.efs({
name: 'myVolume',
fileSystem: myFileSystem,
containerPath: '/Volumes/myVolume',
useJobRole: true,
})],
jobRole: myJobRole,
}),
});
Initializer
new EcsVolume(options: EcsVolumeOptions)
Parameters
- options
Ecs
Volume Options
Properties
Name | Type | Description |
---|---|---|
container | string | The path on the container that this volume will be mounted to. |
name | string | The name of this volume. |
readonly? | boolean | Whether or not the container has readonly access to this volume. |
containerPath
Type:
string
The path on the container that this volume will be mounted to.
name
Type:
string
The name of this volume.
readonly?
Type:
boolean
(optional, default: false)
Whether or not the container has readonly access to this volume.
Methods
Name | Description |
---|---|
static efs(options) | Creates a Volume that uses an AWS Elastic File System (EFS); |
static host(options) | Creates a Host volume. |
static efs(options)
public static efs(options: EfsVolumeOptions): EfsVolume
Parameters
- options
Efs
Volume Options
Returns
Creates a Volume that uses an AWS Elastic File System (EFS);
this volume can grow and shrink as needed
See also: https://docs.aws.amazon.com/batch/latest/userguide/efs-volumes.html
static host(options)
public static host(options: HostVolumeOptions): HostVolume
Parameters
- options
Host
Volume Options
Returns
Creates a Host volume.
This volume will persist on the host at the specified hostPath
.
If the hostPath
is not specified, Docker will choose the host path. In this case,
the data may not persist after the containers that use it stop running.