Search code examples
amazon-ecsecs-taskdefinition

How to escape comma in ECS task definition command


I have docker image and command:

celery -A bits.payment_tracking.app:app worker -l debug -Q celery,reports --concurrency 3

It works perfectly in docker and docker-compose. But it doesn't work in AWS ECS task definition because ECS require to define it separated by comma like this:

celery,-A,bits.payment_tracking.app:app,worker,-l,debug,-Q,celery,reports,--concurrency,3

and this command will not work because -Q celery,reports ECS always split by comma. I know many workarounds but I couldn't find answer to one question - how to escape comma separation in task definition command?

Thanks for your help.


Solution

  • In your task definition, select your latest revision and click "Create New Revision". On the page "Create new revision of Task Definition", click your container name to open the container editor. Under Environment > Command add your comma separated queue command, e.g. php,artisan,queue:work,--tries=1,--queue=queue1,queue2,queue3 Click Update to save the container. Scroll to the bottom of the Task Definition Editor and click "Configure via JSON" which will open a JSON editor. Manually change the command parameter to meet requirements, e.g.

    "command": [
                    "php",
                    "artisan",
                    "queue:work",
                    "--tries=1",
                    "--queue=queue1,queue2,queue3"
                ],
    

    Save the JSON, then click Create to create the revision.