amazon-web-servicesdockeraws-lambdacontainersaws-lambda-containers

Is there any way to give lambda-user access inside container?


Background: Our team is trying to run UI performance testing on lambda. Right now we are running performance test cases uploading our code a zip file on lambda. The challenge here is we are hitting lambda zip file size limit of 50 MB as our application is continuously growing. Then we came across the Lambda containers which has image size limit up-to 10GB.

Problem: We build our docker image with required dependencies and we are able to run our test case locally as well as on Jenkins agent. But when we tried to run same docker image on lambda it gives error - "Lambda user has no write permission for given directory". Google chrome creates files while running the automation script. Lambda has read and write access only inside temp folder. Temp folder size lint is 512MB. Is there any way to give lambda access inside container to run the test cases?


Solution

  • As an educated guess, the answer is no. If Lambda allowed read/write containers, then it would be possible for an image to maliciously or accidentally consume all of the disk space on the node where it is running, and impact the execution of other containers.

    If you need more space, then one option is to mount an EFS filesystem into your Lambda. However, I don't know if it works with a container, or just with ZIP deployments.

    However, given that you've already containerized your application, I think a better solution would be to use ECS rather than Lambda. This will give you 20 GB of ephemeral storage, and you can mount an EFS volume if you need more. An additional benefit of ECS is that you aren't limited to 15 minutes of execution time.