fabfuel / ecs-deploy

Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Other
843 stars 145 forks source link

Run ecs-deploy within a python script #180

Closed bfox1793 closed 2 years ago

bfox1793 commented 2 years ago

Is there a way to call ecs-deploy directly using a Python script (rather than using the CLI)? We are exploring using it, and while we can use bash if needed, Python would be much cleaner / simpler for our team.

Specifically we'd like to avoid using subprocess or similar in python.

fabfuel commented 2 years ago

Hi Brett,

yes, you can use the cli module as a template and use the ecs module directly to:

Compose your task definition like here: https://github.com/fabfuel/ecs-deploy/blob/develop/ecs_deploy/cli.py#L95-L121

And deploy the new task definition like here: https://github.com/fabfuel/ecs-deploy/blob/af252d2035a5542a0581f408b55a0976c784da0c/ecs_deploy/cli.py#L534

Best Fabian