# deployment-ecs

Jonathan Mak

07/02/2021, 11:47 AM
How should I deploy new Dagster code while keeping running jobs alive and retire old instance when last available job there is finished? Say existing A is running a job when new code is deployed which triggers new Docker build and subsequent deployment in ECS for instance B, how can I gracefully let instance A finish its running job and then retire it and let instance B take over? What do I do with Dagit when there are two instances?


07/02/2021, 3:33 PM
What Run Launcher are you using? This is a more general answer than just ECS specifically, but as long as your runs are being launched in a separate task, rolling your dagit/daemon/user code repository grpc server containers shouldn’t impact the run. For example, if you’re using the DefaultRunLauncher, then your runs are probably occurring inside your grpc server task, this could be challenging to achieve. Whereas if you’re using something like our new experimental EcsRunLauncher (or a similar custom one) that spins up a completely new task for each run, you should be able to roll your other tasks without impacting the run.
As for multiple dagit instances, you should be able to load balance across them. The system should run fine with multiple dagits. The daemon on the other hand can only be run once.