Search code examples
amazon-web-servicesamazon-ecsaws-fargate

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


I am deploying containers via AWS Fargate but I am running into "No Space left on device". Is there a way I can specify the volume size in task_definitions:

task_size:
    mem_limit: 2GB
    cpu_limit: 256

Solution

  • As of Fargate platform 1.4, released on 04/2020, ephemeral storage is now 20 GB, instead of 10 GB. Additionally, you can now mount persistent EFS storage volumes in Fargate tasks.

    For example:

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

    Taken from: efs-volumes in Fargate