AWS Copilot Run Task in Running Container

Viewed 242

I have a Django instance running as a Load Balanced Web Service, deployed by AWS Copilot. I would like to run Django Migrations by running a task through Copilot.

I tried running a task like this:

copilot task run --command "python src/manage.py migrate"

However, it doesn't appear to run in my active container. I would expect to see the migrations run, and the service logs along with the updated migrations, but I only see the standard health checks.

copilot/core-api/22 20:07:02 web.1  | INFO:     10.0.1.100:59904 - "GET /healthcheck/ HTTP/1.1" 200 OK
copilot/core-api/22 20:07:17 web.1  | INFO:     10.0.0.117:29060 - "GET /healthcheck/ HTTP/1.1" 200 OK
copilot/core-api/22 20:07:37 web.1  | INFO:     10.0.1.100:59934 - "GET /healthcheck/ HTTP/1.1" 200 OK

Am I misunderstanding task run? I only have 1 app, 1 service, 1 env. I expect task run will be executed in the running service, but maybe it is not?

1 Answers

copilot task run creates a new container. What you are looking for is copilot task exec.

Related