3

我想在 Fargate 上使用大于默认 21GB 的存储空间在 ECS 中旋转任务。首先,我从门户创建了一个任务定义,没有ephemeralStorage

验证任务运行后,我尝试从 cli 注册一个新版本,并添加ephemeralStorage来自https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html的参数

我的任务定义如下所示

{
    "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 }
}

运行 aws cli

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

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

如果我通过该Configure via JSON选项从门户尝试,我会遇到同样的 问题

语法错了吗?该参数不允许操作吗?

4

1 回答 1

3

以下 json 对我有用:

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

我怀疑您的 AWS CLI 可能处于低级状态,可能需要升级到最新版本才能了解(相对)最近的新参数。

于 2021-08-18T13:34:43.803 回答