Reputation: 1431
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
Upvotes: 11
Views: 12965
Reputation: 55
As mentioned by ahj, you can increase the Fargate ephemeral storage in task definition. Example provided in the official docs here.
It's quite disappointing that, at the time of writing this answer, the ephemeralStorage parameter is not configurable from the AWS console. The docs mention that it can be edited via AWS Copilot CLI, CloudFormation, AWS SDK, and AWS CLI.
A common use case is when someone wants to create a new revision of a task definition.
Here's an example of creating a new task definition from a previous revision, with the single difference that now you're setting the ephemeralStorage parameter with Python boto3 (docs for using ECS with boto3 here).
import boto3
client = boto3.client('ecs')
response = client.describe_task_definition(taskDefinition='your-task-definition')
task_definition = response['taskDefinition']
# task_definition is a dictionary, you can print it, or save it in a json file,
# or just view it if you're running from a Python console and you have a variable explorer
# now, create a new revision
client.register_task_definition(
# look at your task_definition dict to fill the arguments and add:
ephemeralStorage={"sizeInGiB": 200}
)
Upvotes: 0
Reputation: 795
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
}
Upvotes: 7
Reputation: 2536
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
Upvotes: 6