Fazil Topal
03/04/2026, 3:58 PMMarvin
03/04/2026, 3:58 PMMarvin
03/04/2026, 4:07 PMprefect worker start will auto-create the work pool if it doesn’t exist, and there’s no flag or env var to disable that for the ECS worker.
Two ways to get the behavior you want:
- Pre-create the ECS work pool (no auto-creation will occur if the pool already exists):
# Ensure prefect-aws is installed so the ECS worker type is registered
pip install prefect-aws
prefect work-pool create "my-ecs-pool" --type ecs
prefect worker start --pool my-ecs-pool
- Start the worker programmatically and disable pool auto-creation:
from prefect_aws.workers.ecs_worker import ECSWorker
import asyncio
async def main():
worker = ECSWorker(
work_pool_name="my-ecs-pool",
name="my-ecs-worker",
create_pool_if_not_found=False, # disable auto-creation
)
await worker.start()
if __name__ == "__main__":
asyncio.run(main())
Run that script in your ECS task container instead of the CLI. If the pool does not exist, the worker will log a warning and exit instead of creating it.
If you want, I can share an example ECS task definition/CMD that invokes the Python entrypoint instead of prefect worker start.