Create ECS Task Definition

Let’s create an AWS ECS Task Definition - a JSON file that defines the configuration of a task in Amazon Elastic Container Service (ECS). It acts like a blueprint that tells AWS ECS how to run a Docker container, including information about the container image, resources, environment variables, networking, logging, and IAM roles.

1. Go to AWS ECS console.

2. In the left sidebar,

  • Choose Task definitions.
  • Click Create new task definition.

0001

3. In the Task definition configuration section, enter awsome-books for Task definition family.

0002

4. In the Infrastructure requirements section,

  • For Task role, choose ecsTaskRole.
  • For Task execution role, choose Create new role.

0003

5. In the Container - 1 section,

  • For Name, enter awsome-books.
  • For Image URI, choose one that you have noted down in step 9 in 5. Create AWS ECR.
  • For Container port, enter 8080.

0004

6. Scroll down to the bottom, click Create.

0005