diff --git a/airflow/providers/amazon/aws/operators/ecs.py b/airflow/providers/amazon/aws/operators/ecs.py index 1cd8685cf282f..433fd88cd636e 100644 --- a/airflow/providers/amazon/aws/operators/ecs.py +++ b/airflow/providers/amazon/aws/operators/ecs.py @@ -373,6 +373,10 @@ class EcsRunTaskOperator(EcsBaseOperator): When capacity_provider_strategy is specified, the launch_type parameter is omitted. If no capacity_provider_strategy or launch_type is specified, the default capacity provider strategy for the cluster is used. + :param volume_configurations: the volume configurations to use when using capacity provider. The name of the volume must match + the name from the task definition. + You can configure the settings like size, volume type, IOPS, throughput and others mentioned in + (https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskManagedEBSVolumeConfiguration.html) :param group: the name of the task group associated with the task :param placement_constraints: an array of placement constraint objects to use for the task @@ -420,6 +424,7 @@ class EcsRunTaskOperator(EcsBaseOperator): "overrides", "launch_type", "capacity_provider_strategy", + "volume_configurations", "group", "placement_constraints", "placement_strategy", @@ -450,6 +455,7 @@ def __init__( overrides: dict, launch_type: str = "EC2", capacity_provider_strategy: list | None = None, + volume_configurations: list | None = None, group: str | None = None, placement_constraints: list | None = None, placement_strategy: list | None = None, @@ -479,6 +485,7 @@ def __init__( self.overrides = overrides self.launch_type = launch_type self.capacity_provider_strategy = capacity_provider_strategy + self.volume_configurations = volume_configurations self.group = group self.placement_constraints = placement_constraints self.placement_strategy = placement_strategy @@ -614,6 +621,8 @@ def _start_task(self): if self.capacity_provider_strategy: run_opts["capacityProviderStrategy"] = self.capacity_provider_strategy + if self.volume_configurations is not None: + run_opts["volumeConfigurations"] = self.volume_configurations elif self.launch_type: run_opts["launchType"] = self.launch_type if self.platform_version is not None: diff --git a/tests/providers/amazon/aws/operators/test_ecs.py b/tests/providers/amazon/aws/operators/test_ecs.py index a6915214a0764..fefdb595dacda 100644 --- a/tests/providers/amazon/aws/operators/test_ecs.py +++ b/tests/providers/amazon/aws/operators/test_ecs.py @@ -172,6 +172,7 @@ def test_template_fields_overrides(self): "overrides", "launch_type", "capacity_provider_strategy", + "volume_configurations", "group", "placement_constraints", "placement_strategy",