lambci / docker-lambda

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

Update lambda execution runtime to 2018.03 #185

Closed SalmaanP closed 5 years ago

SalmaanP commented 5 years ago

Lambda execution environment is being updated as per this blogpost.

mhart commented 5 years ago

This was already done a while back: https://github.com/lambci/docker-lambda/commit/e2c23e6d10f6ff423611650cf235340f4d1f9adf

mhart commented 5 years ago

The blog post you linked to is talking about this repo:

We’re providing an update to the AWS SAM CLI to enable you to test your functions locally against this new execution environment. The AWS SAM CLI uses a Docker image that mirrors the live Lambda environment locally wherever you do development.

That's this image 😄

SalmaanP commented 5 years ago

oh I see, this is my first lambda function so I am still exploring a lot of new things. do you mind if I ask you a question here? How do I use AWS SAM CLI to build my dependencies, test the handler and then create a zip to upload.

Right now I have this docker file which does all this

FROM lambci/lambda:build-python2.7

COPY . .

RUN mkdir package && cd package &&  \
    pip install rsa --target . && \
    zip -r9 ../function.zip . &&  \
    cd ../ &&  \
    zip -g function.zip lambda_function.py

CMD aws lambda update-function-code --function-name test --zip-file fileb://function.zip

Do you think this is a standard way, and then how do I test the function with the dependencies.