Creating a task definition using the classic console
The classic Amazon ECS console is reaching the end of life and will no longer be available after December 4, 2023. We recommend that you switch immediately to the new Amazon ECS console for a better experience. You can review and follow the new Amazon ECS console roadmap on GitHub. |
Important
Amazon ECS has provided a new console experience for creating task definitions. For more information, see Creating a task definition using the console.
You must use the new console to create a task definition for Windows containers on
Fargate with the WINDOWS_SERVER_2022_FULL
, or
WINDOWS_SERVER_2022_CORE
operating system.
Before running Docker containers on Amazon ECS, you must first create a task definition. When you create a task definition, you can use it to define multiple containers and data volumes. For more information about the available parameters for task definitions, see Task definition parameters.
To create a new task definition (classic Amazon ECS console)
Open the Amazon ECS classic console at https://console.aws.amazon.com/ecs/
. -
In the navigation pane, choose task definitions, Create new task definition.
-
On the Select launch type compatibilities page, choose FARGATE and then Next step.
-
(Optional) If you have a JSON representation of your task definition, complete the following steps:
-
On the Configure task and container definitions page, scroll to the bottom of the page and choose Configure via JSON.
-
Paste your task definition JSON into the text area and choose Save.
-
Verify your information and choose Create.
Scroll to the bottom of the page and choose Configure via JSON.
-
-
For Task Definition Name, type a name for your task definition. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
-
For Operating system family, choose the container operating system.
-
For Task execution IAM role, either select your task execution role or choose Create new role so that the console can create one for you. For more information, see Amazon ECS task execution IAM role.
-
For Task size, choose a value for Task memory (GB) and Task CPU (vCPU). The table below shows the valid combinations.
CPU value
Memory value
Operating systems supported for AWS Fargate
256 (.25 vCPU)
512 MiB, 1 GB, 2 GB
Linux
512 (.5 vCPU)
1 GB, 2 GB, 3 GB, 4 GB
Linux
1024 (1 vCPU)
2 GB, 3 GB, 4 GB, 5 GB, 6 GB, 7 GB, 8 GB
Linux, Windows
2048 (2 vCPU)
Between 4 GB and 16 GB in 1 GB increments
Linux, Windows
4096 (4 vCPU)
Between 8 GB and 30 GB in 1 GB increments
Linux, Windows
8192 (8 vCPU)
Note
This option requires Linux platform
1.4.0
or later.Between 16 GB and 60 GB in 4 GB increments
Linux
16384 (16vCPU)
Note
This option requires Linux platform
1.4.0
or later.Between 32 GB and 120 GB in 8 GB increments
Linux
-
For each container in your task definition, complete the following steps:
-
Choose Add container.
-
Fill out each required field and any optional fields to use in your container definitions. More container definition parameters are available in the Advanced container configuration menu. For more information, see Task definition parameters.
-
Choose Add to add your container to the task definition.
-
-
(Optional) For Service Integration, to configure the parameters for App Mesh integration, choose Enable App Mesh integration and then do the following:
-
For Mesh name, choose the existing App Mesh service mesh to use. If you don't see any meshes listed, then you need to create one first. For more information, see Service meshes in the AWS App Mesh User Guide.
Note
This option is not available for Windows containers on Fargate.
-
For App Mesh endpoints, select one of the following options.
Virtual node – Enter or select the following information.
For Application container name, choose the container name to use for the App Mesh integration. This container must already be defined within the task definition.
For Virtual node name, choose the existing App Mesh virtual node to use. If you don't see any virtual nodes listed, then you need to create one first. For more information, see Virtual nodes in the AWS App Mesh User Guide.
For Virtual node port – Pre-populated with the listener port set on the virtual node in App Mesh.
Virtual gateway – Enter or select the following information.
For Virtual gateway name, choose the existing App Mesh virtual gateway to use. If you don't see any virtual gateways listed, then you need to create one first. For more information, see Virtual gateways in the AWS App Mesh User Guide.
For Virtual gateway port – Pre-populated with the listener port set on the virtual gateway in App Mesh.
-
For Envoy image, enter
840364872350
.dkr.ecr.us-west-2
.amazonaws.com/aws-appmesh-envoy:v1.15.1.0-prod for all regions exceptme-south-1
andap-east-1
. You can replaceus-west-2
with any Region exceptme-south-1
andap-east-1
. If your application is in one of these regions, then you also need to replace840364872350
with the appropriate value for your Region. For more information, see Envoy image in the AWS App Mesh User Guide. -
Choose Apply and then choose Confirm. This will add an Envoy proxy container to the task definition, as well as the settings to support it. If you selected Virtual node, it will also auto-populate the App Mesh Proxy Configuration settings for the next step. If you selected Virtual gateway, then the Proxy Configuration is disabled, because it's not used for a virtual gateway.
-
-
(Optional) If you selected Virtual node in Service Integration, then for Proxy Configuration, verify all of the pre-populated values. For more information about these fields, see the JSON tab in Update services.
-
(Optional) For Log Router Integration, you can add a custom log routing configuration. Choose Enable FireLens integration and then do the following:
Note
This option is not available for Windows containers on Fargate.
-
For Type, choose the log router type to use.
-
For Image, type the image URI for your log router container. If you chose the
fluentbit
log router type, the Image field pre-populates with the AWS for Fluent Bit image. For more information, see Using the AWS for Fluent Bit image. -
Choose Apply. This creates a new log router container to the task definition named
log_router
, and applies the settings to support it. If you make changes to the log router integration fields, choose Apply again to update the FireLens container.
-
-
(Optional) To define data volumes for your task, choose Add volume. For more information, see Using data volumes in tasks.
-
For Name, type a name for your volume. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
-
-
In the Tags section, specify the key and value for each tag to associate with the task definition. For more information, see Tagging Your Amazon ECS Resources.
-
Choose Create.
To create a new task definition (AWS CLI)
-
Use the
register-task-definition
command. For more information, see register-task-definition in the AWS Command Line Interface Reference.