Search code examples
amazon-web-servicesamazon-ecsaws-fargateecs-taskdefinition

Unable to register task definition with ephemeralStorage parameter in ECS Fargate


I wanted to spin tasks in ECS on Fargate with storage bigger than the default 21GB. First I created a task definition from the portal without ephemeralStorage

After verifying the task runs I tried registering a new version from the cli with added parameter ephemeralStorage from https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html

My task definition looks like this

{
    "containerDefinitions": [
        {
            "name": "python-container",
            "image": "xxxx/python-trial:v1.0",
            "cpu": 0,
            "portMappings": [],
            "essential": true,
            "environment": [],
            "mountPoints": [],
            "volumesFrom": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/python-trial-td",
                    "awslogs-region": "eu-east-1",
                    "awslogs-stream-prefix": "ecs"
                }
            }
        }
    ],
    "family": "python-trial-td",
    "taskRoleArn": "arn:aws:iam::xxxx:role/ecsTaskExecutionRole",
    "executionRoleArn": "arn:aws:iam::xxxx:role/ecsTaskExecutionRole",
    "networkMode": "awsvpc",
    "volumes": [],
    "placementConstraints": [],
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "cpu": "256",
    "memory": "512",
    "ephemeralStorage": {"sizeInGiB": 100 }
}

Running aws cli

aws ecs register-task-definition --family python-trial-td --cli-input-json file://task-definition-python.json

gives

Parameter validation failed:
Unknown parameter in input: "ephemeralStorage", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAccelerators

If I try from the portal via the Configure via JSON option I get the same issue

Is the syntax wrong? Is the operation not allowed for that parameter?


Solution

  • The following json works for me:

    {
    ...
    ...
        "cpu": "256",
        "memory": "512",
        "ephemeralStorage": {"sizeInGiB": 100 }
    }
    

    I suspect your AWS CLI could be downlevel and may need an upgrade to the latest version to know about the (relatively) recent new parameter.