Interface CfnTaskDefinition.IVolumeProperty
The Volume
property specifies a data volume used in a task definition.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public interface IVolumeProperty
Syntax (vb)
Public Interface IVolumeProperty
Remarks
For tasks that use a Docker volume, specify a DockerVolumeConfiguration
. For tasks that use a bind mount host volume, specify a host
and optional sourcePath
. For more information about host
and optional sourcePath
, see Volumes and Using Data Volumes in Tasks .
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;
var volumeProperty = new VolumeProperty {
DockerVolumeConfiguration = new DockerVolumeConfigurationProperty {
Autoprovision = false,
Driver = "driver",
DriverOpts = new Dictionary<string, string> {
{ "driverOptsKey", "driverOpts" }
},
Labels = new Dictionary<string, string> {
{ "labelsKey", "labels" }
},
Scope = "scope"
},
EfsVolumeConfiguration = new EFSVolumeConfigurationProperty {
FilesystemId = "filesystemId",
// the properties below are optional
AuthorizationConfig = new AuthorizationConfigProperty {
AccessPointId = "accessPointId",
Iam = "iam"
},
RootDirectory = "rootDirectory",
TransitEncryption = "transitEncryption",
TransitEncryptionPort = 123
},
Host = new HostVolumePropertiesProperty {
SourcePath = "sourcePath"
},
Name = "name"
};
Synopsis
Properties
DockerVolumeConfiguration | This parameter is specified when you use Docker volumes. |
EfsVolumeConfiguration | This parameter is specified when you use an Amazon Elastic File System file system for task storage. |
Host | This parameter is specified when you use bind mount host volumes. |
Name | The name of the volume. |
Properties
DockerVolumeConfiguration
This parameter is specified when you use Docker volumes.
virtual object DockerVolumeConfiguration { get; }
Property Value
System.Object
Remarks
Windows containers only support the use of the local
driver. To use bind mounts, specify the host
parameter instead.
Docker volumes aren't supported by tasks run on AWS Fargate .
EfsVolumeConfiguration
This parameter is specified when you use an Amazon Elastic File System file system for task storage.
virtual object EfsVolumeConfiguration { get; }
Property Value
System.Object
Remarks
Host
This parameter is specified when you use bind mount host volumes.
virtual object Host { get; }
Property Value
System.Object
Remarks
The contents of the host
parameter determine whether your bind mount host volume persists on the host container instance and where it's stored. If the host
parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn't guaranteed to persist after the containers that are associated with it stop running.
Windows containers can mount whole directories on the same drive as
$env:ProgramData
. Windows containers can't mount directories on a different drive, and mount point can't be across drives. For example, you can mount C:\my\path:C:\my\path
and D::D:</code> , but not
D:\my\path:C:\my\path
or D::C:\my\path
.
Name
The name of the volume.
virtual string Name { get; }
Property Value
System.String
Remarks
Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. This name is referenced in the sourceVolume
parameter of container definition mountPoints
.