diff --git a/cosmos/operators/aws_ecs.py b/cosmos/operators/aws_ecs.py index 2decbcc6c4..98061269ff 100644 --- a/cosmos/operators/aws_ecs.py +++ b/cosmos/operators/aws_ecs.py @@ -21,6 +21,8 @@ logger = get_logger(__name__) +DEFAULT_CONN_ID = "aws_default" +DEFAULT_CONTAINER_NAME = "dbt" DEFAULT_ENVIRONMENT_VARIABLES: dict[str, str] = {} try: @@ -47,10 +49,10 @@ class DbtAwsEcsBaseOperator(AbstractDbtBase, EcsRunTaskOperator): # type: ignor def __init__( self, # arguments required by EcsRunTaskOperator - aws_conn_id: str, cluster: str, task_definition: str, - container_name: str, + container_name: str = DEFAULT_CONTAINER_NAME, + aws_conn_id: str = DEFAULT_CONN_ID, # profile_config: ProfileConfig | None = None, command: list[str] | None = None, @@ -66,6 +68,7 @@ def __init__( "aws_conn_id": aws_conn_id, "task_definition": task_definition, "cluster": cluster, + "container_name": container_name, "overrides": None, } ) diff --git a/tests/operators/test_aws_ecs.py b/tests/operators/test_aws_ecs.py index 230c1616a2..af9ed226d4 100644 --- a/tests/operators/test_aws_ecs.py +++ b/tests/operators/test_aws_ecs.py @@ -185,6 +185,7 @@ def test_dbt_aes_ecs_overrides_parameter(): assert "containerOverrides" in actual_overrides actual_container_overrides = actual_overrides["containerOverrides"][0] + assert actual_container_overrides["name"] == "my-dbt-container-name" assert isinstance(actual_container_overrides["command"], list), "`command` should be of type list" assert "environment" in actual_container_overrides