When my AWS Batch job fails, I receive the following error: "No space left on device."
Short description
The Amazon Elastic Compute Cloud (ECS) optimized Linux Amazon Machine Image (AMI) and Amazon Linux 2023 AMI both ship with a single 30-GiB root volume. For more information, see Amazon ECS-optimized Linux AMIs.
To increase the volume size with AWS Batch, use the launch template. Then, all new instances launched in the compute environment will include the additional volume in the template.
Note: The Amazon ECS-optimized Amazon Linux AMI 1 is no longer supported. To maintain optimal performance and security, use AWS Batch to migrate your compute environments.
Resolution
To increase the volume size, complete the following steps:
- Create a custom launch template with an increased root volume for the instance. Increase the VolumeSize value so that it's more than the current value. For more information, see Use Amazon EC2 launch template with AWS Batch.
Note: The size increase for /dev/xvda must apply only to the DeviceName value.
- To create a new compute environment, use the launch template. Or, update the existing compute environment.
The instances reflect the new drive sizes.
Note: Add a new launch template with Best_fit allocation strategy to the compute environment. If you can't edit your existing compute environment, then create a new compute environment.https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html