Class EcsVolume
Represents a Volume that can be mounted to a container that uses ECS.
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class EcsVolume : DeputyBase
Syntax (vb)
Public MustInherit Class EcsVolume
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
IFileSystem myFileSystem;
Role myJobRole;
myFileSystem.GrantRead(myJobRole);
var jobDefn = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
Memory = Size.Mebibytes(2048),
Cpu = 256,
Volumes = new [] { EcsVolume.Efs(new EfsVolumeOptions {
Name = "myVolume",
FileSystem = myFileSystem,
ContainerPath = "/Volumes/myVolume",
UseJobRole = true
}) },
JobRole = myJobRole
})
});
Synopsis
Constructors
EcsVolume(IEcsVolumeOptions) | |
EcsVolume(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
EcsVolume(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
ContainerPath | The path on the container that this volume will be mounted to. |
Name | The name of this volume. |
Readonly | Whether or not the container has readonly access to this volume. |
Methods
Efs(IEfsVolumeOptions) | Creates a Volume that uses an AWS Elastic File System (EFS); |
Host(IHostVolumeOptions) | Creates a Host volume. |
Constructors
EcsVolume(IEcsVolumeOptions)
EcsVolume(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected EcsVolume(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
EcsVolume(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected EcsVolume(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
ContainerPath
The path on the container that this volume will be mounted to.
public virtual string ContainerPath { get; }
Property Value
System.String
Name
The name of this volume.
public virtual string Name { get; }
Property Value
System.String
Readonly
Whether or not the container has readonly access to this volume.
public virtual Nullable<bool> Readonly { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Methods
Efs(IEfsVolumeOptions)
Creates a Volume that uses an AWS Elastic File System (EFS);
public static EfsVolume Efs(IEfsVolumeOptions options)
Parameters
- options IEfsVolumeOptions
Returns
Remarks
this volume can grow and shrink as needed
See: https://docs.aws.amazon.com/batch/latest/userguide/efs-volumes.html
Host(IHostVolumeOptions)
Creates a Host volume.
public static HostVolume Host(IHostVolumeOptions options)
Parameters
- options IHostVolumeOptions
Returns
Remarks
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.