Creating a task definition
In this section, we will create a task definition for a hello-world
application using the tutum/hello-world
Docker image. Another Docker image that exposes a HTTP port may also be used, but not all Docker images may be used. As an unsuitable example, the MySQL database Docker image, mysql
, cannot be used with an application load balancer, as it exposes a TCP port, 3306
. For an ECS task that exposes a TCP port, a network load balancer should be used.
- To create a new task definition, select
Task Definitions
in the ECS console, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781789345018/graphics/f5846184-9d89-4bf2-9e36-1c2d5ccc709a.png)
- In
Task Definitions
, click onCreate new Task Definition
, as shown in the following screenshot:
![](https://static.packt-cdn.com/products/9781789345018/graphics/e3da8718-f920-402b-a05d-07d8a1fdd649.png)
- In
Create new
Task Definition
, selectFargate
as the launch type compatibility, as shown in the following screenshot. Scroll down and click onNext step
:
![](https://static.packt-cdn.com/products/9781789345018/graphics/06b80c4e-ba7d-42c9-b501-2c7c53086976.png)
- In
Configure task and container definitions
, specify aTask Definition Name
(hello-world-task-definition
) and selecte
csTaskExecutionRole
as theTask Role
, as shown...