3

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?

Rohini
  • 91
  • 2
  • 8

1 Answers1

4

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.

mreferre
  • 5,464
  • 3
  • 22
  • 29
  • 2
    You're right! It's added in version 2.2.1 and mine was older. Ref https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst#221 – Rohini Aug 18 '21 at 16:42
  • 2
    I tried adding it via the UI but that doesn't work...even if you use the Configure by JSON button... – ndtreviv Oct 04 '21 at 14:53
  • 1
    This is not supported yet in the UI. [You can configure the size of the ephemeral storage for your Amazon ECS Tasks running on AWS Fargate platform version 1.4.0 or higher in all regions where AWS Fargate is available using AWS Copilot CLI, CloudFormation, AWS SDK, and AWS CLI.](https://aws.amazon.com/about-aws/whats-new/2021/04/amazon-ecs-aws-fargate-configure-size-ephemeral-storage-tasks/) – mreferre Oct 04 '21 at 17:38
  • 1
    I am having the same (frustrating) experience. As of 2021-01-24, it is still not supported in the UI and two versions of the AWS CLI are rejecting me. Neither *aws-cli/1.18.147 Python/2.7.18 Linux/5.4.156-94.273.amzn2int.x86_64 botocore/1.18.6* nor *aws-cli/1.18.198 Python/3.6.9 Linux/4.4.0-19041-Microsoft botocore/1.19.38* allow `ephemeralStorage`. Finally got it to work after [upgrading](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) to *aws-cli/2.4.13 Python/3.8.8 Linux/4.4.0-19041-Microsoft exe/x86_64.ubuntu.18 prompt/off*. – 0xbe5077ed Jan 25 '22 at 01:28
  • 1
    It's still not supported in the UI. – Josh Withee Aug 18 '22 at 14:59
  • It's still not supported in the UI. – jackofallcode Dec 01 '22 at 16:34
  • Please note this comment is now out of date. Please see my answer. – bearrito Dec 06 '22 at 04:51