Creating a task to run our containers
In this recipe, we will create an ECS task. A task tells the ECR cluster manager which containers to run. A task is a description of which containers in ECR to run and the parameters required for each. The task description will feel a lot like that which we have done with Docker Compose.
Getting ready
The task definition can be built with the GUI or started by submitting a task definition JSON file. We will use the latter technique and examine the structure of the file, td.json
, which describes how to run our containers together. This file is in the 11/07
recipe folder.
How to do it
The following command registers the task with ECS:
$ aws ecs register-task-definition --cli-input-json file://td.json { "taskDefinition": { "volumes": [ ], "family": "scraper", "memory": "4096", "placementConstraints": [ ] ], "cpu": "1024", "containerDefinitions": [ { "name": "rabbitmq", "cpu": 0, "volumesFrom": [ ...