We need to Increase Disk Space for Amazon ECS Container on Fargate if the underlying container host machine runs out of disk storage.
Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.
Today, let us see how we can increase disk space.
Disk Space for Amazon ECS Container on Fargate
By default, Fargate tasks with platform version 1.40 have a task storage size of 20 GB as a single ephemeral volume.
Tasks using the Fargate launch type include Amazon Elastic File System (Amazon EFS).
If the underlying container host machine runs out of disk storage, then we see the “No space left on device” error message.
This means that the application workload running inside the container requires large or persistent storage to process large datasets and files.
We can solve this by integrating Fargate tasks with Amazon EFS volumes.
Increase Disk Space for Amazon ECS Container on Fargate
1. Initially, we need to create a security group for the Amazon EFS mount targets.
Then we add an inbound rule to accept NFS traffic on port 2049 from the source’s task security group.
2. We create an Amazon EFS file system, and then attach the security group to the mount targets.
3. In addition, we need to note the file system ID of the file system.
4. Create or update a task definition to configure a volume for the Amazon ECS task that has the Amazon EFS file system.
For example:
"volumes": [
{
"name": "efs-test-volume",
"efsVolumeConfiguration": {
"fileSystemId": "fs-12345678",
"transitEncryption": "ENABLED"
}
}
]
Here, make sure to Replace fs-12345678 with the appropriate file system ID.
5. Later we use a container definitions section to create a mount point for the volume inside the container.
For example:
"containerDefinitions": [
{
"memory": 128,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80,
"protocol": "tcp"
}
],
"essential": true,
"mountPoints": [
{
"containerPath": "/mount/path/inside/container",
"sourceVolume": "efs-test-volume"
}
],
"name": "nginx",
"image": "nginx"
}
]
6. Finally, we run the task using the updated task definition.
[Stuck with the procedures? We’d be happy to assist you]
Conclusion
In short, we saw how our Support Techs fix the disk space error for our customers.
0 Comments