@aws-cdk_aws-batch-alpha.EcsVolume

class EcsVolume ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Batch.Alpha.EcsVolume
Gogithub.com/aws/aws-cdk-go/awscdkbatchalpha/v2#EcsVolume
Javasoftware.amazon.awscdk.services.batch.alpha.EcsVolume
Pythonaws_cdk.aws_batch_alpha.EcsVolume
TypeScript (source)@aws-cdk/aws-batch-alpha ยป EcsVolume

Implemented by EfsVolume, HostVolume

Represents a Volume that can be mounted to a container that uses ECS.

Example

import * as cdk from 'aws-cdk-lib';
import * as efs from 'aws-cdk-lib/aws-efs';

declare const myFileSystem: efs.IFileSystem;

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',
    })],
  }),
});

Initializer

new EcsVolume(options: EcsVolumeOptions)

Parameters

  • options EcsVolumeOptions

Properties

NameTypeDescription
containerPath๐Ÿ”นstringThe path on the container that this volume will be mounted to.
name๐Ÿ”นstringThe name of this volume.
readonly?๐Ÿ”นbooleanWhether 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

NameDescription
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 EfsVolumeOptions

Returns

  • EfsVolume

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 HostVolumeOptions

Returns

  • HostVolume

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.