lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.83k stars 431 forks source link

Setting lambda function memory size #175

Closed Anjali05 closed 5 years ago

Anjali05 commented 5 years ago

I am using the lambda docker image for local testing(Python 2.7). I want to know if there is any way I can set the function handler memory size in the argument list? Something like this, $ aws lambda update-function-configuration --function-name myfunction --memory-size 256

mhart commented 5 years ago

Docker allows you to restrict memory with the -m flag – and if you want to be 100% accurate you can also change the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable, so run it like this:

docker run -m 256M -e AWS_LAMBDA_FUNCTION_MEMORY_SIZE=256 ...

mhart commented 5 years ago

Docker documentation is here: https://docs.docker.com/engine/reference/run/#user-memory-constraints