Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 464
user_dev Avatar asked May 29 '20 20:05

user_dev


People also ask

Is EBS supported on fargate?

Support for Amazon EBS volumes isn't available for tasks on Fargate.

Why is fargate more expensive than EC2?

This is because, with Fargate, you only pay for the amount of resources you provision. Fargate is better than EC2 in terms of flexibility. However, there is no long-term commitment to the resources you have provisioned. Hence if you require flexibility, then go for Fargate.

What is the difference between fargate and ECS?

If you need auto-scaling or run containers in a serverless environment, then Fargate is the right choice. But, ECS is better if you need more flexibility or are on a budget. Overall, both services are excellent choices for running containers in AWS. It just comes down to your specific needs and preferences.


2 Answers

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

like image 117
Adi Dembak Avatar answered Oct 19 '22 19:10

Adi Dembak


You can now increase your fargate ephemeral storage to 200GB in task definition. Therefore with this there is no need to attach the volume unless you need a storage of larger than 200GB.

"ephemeralStorage": {
   "sizeInGiB": 200
}
like image 39
ahj Avatar answered Oct 19 '22 19:10

ahj