Configuring an EC2 (not Fargate) instance via task_definition.json

Currently we have a working task_definition file for a AWS Fargate instance.

We want to migrate from Fargate to a specific AWS EC2 instance, e.g. Z1d.

From the AWS documentation I found that the ecs.instance-type parameter needs to be added.
Unfortunately it does not state where it should be added in the task_definition.json file.
Currently we have something along the lines of:

{
  "family": "generic-family",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "4096",
  "memory": "8192",
  ...
  "containerDefinitions": [
                            {
                              "name": "generic-docker-name",
                              "image": "...",
                            },
                          ]
}

We think it should be something like:

{
  "family": "generic-family",
  "requiresCompatibilities": ["EC2"],
  "ecs.instance-type": "Z1d",
  ...
  "containerDefinitions": [
                            {
                              "name": "generic-docker-name",
                              "image": "...",
                            },
                          ]
}

Or looking at some other documentation:

{
  "family": "generic-family",
  "requiresCompatibilities": ["EC2"],
  ...
  "containerDefinitions": [
                            {
                              "name": "generic-docker-name",
                              "image": "...",
                              "Parameters": {
                                "InstanceTypeParameter" : {
                                  "Type" : "String",
                                  "Default" : "z1d.large",
                                  "AllowedValues" : ["z1d.large"],
                                  "Description" : "..."
                                }
                              }
                            },
                          ]
}

But that doesn’t seem to work.

Does anyone know how this should be done? Or how I should read the AWS documentation for this specific topic?

Source: StackOverflow