# VolumeProperty

The data volume configuration for tasks launched using this task definition.

Specifying a volume configuration in a task definition is optional. The volume configuration may contain multiple volumes but only one volume configured at launch is supported. Each volume defined in the volume configuration may only specify a ``name`` and one of either ``configuredAtLaunch``, ``dockerVolumeConfiguration``, ``efsVolumeConfiguration``, ``s3filesVolumeConfiguration``, ``fsxWindowsFileServerVolumeConfiguration``, or ``host``. If an empty volume configuration is specified, by default Amazon ECS uses a host volume. For more information, see [Using data volumes in tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html).

- Source: Generated at build time
- Type last changed: v2.276.0 · 10 Nov 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const volumeProperty: ecs.CfnDaemonTaskDefinition.VolumeProperty = {
  host: {
    sourcePath: 'sourcePath',
  },
  logDriverVolumeConfiguration: {
    driver: 'driver',
  },
  name: 'name',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

volume_property = ecs.CfnDaemonTaskDefinition.VolumeProperty(
    host=ecs.CfnDaemonTaskDefinition.HostVolumePropertiesProperty(
        source_path="sourcePath"
    ),
    log_driver_volume_configuration=ecs.CfnDaemonTaskDefinition.LogDriverVolumeConfigurationProperty(
        driver="driver"
    ),
    name="name"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

VolumeProperty volumeProperty = VolumeProperty.builder()
        .host(HostVolumePropertiesProperty.builder()
                .sourcePath("sourcePath")
                .build())
        .logDriverVolumeConfiguration(LogDriverVolumeConfigurationProperty.builder()
                .driver("driver")
                .build())
        .name("name")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// 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 {
    Host = new HostVolumePropertiesProperty {
        SourcePath = "sourcePath"
    },
    LogDriverVolumeConfiguration = new LogDriverVolumeConfigurationProperty {
        Driver = "driver"
    },
    Name = "name"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

volumeProperty := &VolumeProperty{
	Host: &HostVolumePropertiesProperty{
		SourcePath: jsii.String("sourcePath"),
	},
	LogDriverVolumeConfiguration: &LogDriverVolumeConfigurationProperty{
		Driver: jsii.String("driver"),
	},
	Name: jsii.String("name"),
}
```

## Properties

- `host`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDaemonTaskDefinition.HostVolumePropertiesProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnDaemonTaskDefinition.HostVolumePropertiesProperty.html) — Details on a container instance bind mount host volume.

- `logDriverVolumeConfiguration`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnDaemonTaskDefinition.LogDriverVolumeConfigurationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnDaemonTaskDefinition.LogDriverVolumeConfigurationProperty.html)

- `name`: string — The name of the volume.

  Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.
   When using a volume configured at launch, the ``name`` is required and must also be specified as the volume name in the ``ServiceVolumeConfiguration`` or ``TaskVolumeConfiguration`` parameter when creating your service or standalone task.
   For all other types of volumes, this name is referenced in the ``sourceVolume`` parameter of the ``mountPoints`` object in the container definition.
   When a volume is using the ``efsVolumeConfiguration``, the name is required.
   When a volume is using the ``s3filesVolumeConfiguration``, the name is required.
