如何增加 AWS Fargate 容器中的磁盘 space?

How can I increase the disk space in AWS Fargate container?

我正在通过 AWS Fargate 部署容器,但我 运行 进入 "No Space left on device"。有没有一种方法可以在 task_definitions:

中指定卷大小
task_size:
    mem_limit: 2GB
    cpu_limit: 256

从 04/2020 发布的 Fargate 平台 1.4 开始,临时存储现在为 20 GB,而不是 10 GB。 此外,您现在可以在 Fargate 任务中安装持久性 EFS 存储卷。

例如:

{
    "containerDefinitions": [
        {
            "name": "container-using-efs",
            "image": "amazonlinux:2",
            "entryPoint": [
                "sh",
                "-c"
            ],
            "command": [
                "ls -la /mount/efs"
            ],
            "mountPoints": [
                {
                    "sourceVolume": "myEfsVolume",
                    "containerPath": "/mount/efs",
                    "readOnly": true
                }
            ]
        }
    ],
    "volumes": [
        {
            "name": "myEfsVolume",
            "efsVolumeConfiguration": {
                "fileSystemId": "fs-1234",
                "rootDirectory": "/path/to/my/data",
                "transitEncryption": "ENABLED",
                "transitEncryptionPort": integer,
                "authorizationConfig": {
                    "accessPointId": "fsap-1234",
                    "iam": "ENABLED"
                }
            }
        }
    ]
}

摘自: efs-volumes in Fargate

您现在可以在任务定义中将 Fargate 临时存储增加到 200GB。因此,除非您需要大于 200GB 的存储空间,否则无需附加卷。

"ephemeralStorage": {
   "sizeInGiB": 200
}