Search code examples
amazon-web-servicesaws-lambdacontainers

AWS Lambda using a Container Image throwing a no space left on device


I am trying to figure out if there is a config issue that needs resolving or if I really somehow ended up using all 10GB (though that seems unlikely as the image is 849MB) but I am getting a no space left on device error when running my lambda with containers. Any one know why that might be? (do I need to dump things to a tmp folder? I am trying to run a tensor flow project in this particular lambda, so that may be a thing I need to investigate?)


Solution

  • From the documentation

    The container image must be able to run on a read-only file system. Your function code can access a writable /tmp directory with 512 MB of storage.

    So if you're attempting to write a file in the "current" directory (normally /var/task), it won't work.

    There are several ways that you can work around this:

    1. If your file fits in 512 MB and then gets uploaded somewhere, write it to /tmp.
    2. Use in-memory data structures (you don't mention your language, but, for example, io.BytesIO or io.StringIO in Python, or java.io.ByteArrayOutputStream in Java). The "10 GB" that you mention in your question is memory (RAM), not disk.
    3. If you need to write to disk, and need more than 512 MB, mount an EFS volume.