AWS Lambda container! #77
Replies: 8 comments
-
if the containers are based on amazonlinux2 we can simply do FROM lambgeo/lambda-gdal:3.2-al2
FROM public.ecr.aws/lambda/python:3.8
# Bring C libs from lambgeo/lambda-gdal image
COPY --from=gdal /opt/lib/ /opt/lib/
COPY --from=gdal /opt/include/ /opt/include/
COPY --from=gdal /opt/share/ /opt/share/
COPY --from=gdal /opt/bin/ /opt/bin/
ENV \
GDAL_DATA=/opt/share/gdal \
PROJ_LIB=/opt/share/proj \
GDAL_CONFIG=/opt/bin/gdal-config \
GEOS_CONFIG=/opt/bin/geos-config \
PATH=/opt/bin:$PATH |
Beta Was this translation helpful? Give feedback.
-
The more I think about it, the more I think this is a documentation issue. We will just need to explain how to build the container with the snipset ☝️ |
Beta Was this translation helpful? Give feedback.
-
And maybe an example too... |
Beta Was this translation helpful? Give feedback.
-
They also allow debian containers. Why not use the original gdal container and just include AWS' Lambda Runtime? |
Beta Was this translation helpful? Give feedback.
-
@meyer1994 by using your own container (read here, not built from the official amazonlinux image), you'll need to add the lambda API. That's another solution which could also be 👌. |
Beta Was this translation helpful? Give feedback.
-
The example dockerfile in https://github.com/lambgeo/docker-lambda#1-create-dockerfile works (or at least seems too! I probably need to test more) for this if you replace the zip commands with:
where you have file handler.py with function |
Beta Was this translation helpful? Give feedback.
-
And if there was the desire to have a roll-your-own image, you would need to copy the lambda_entrypoint.sh file from Lambda base image and set that as the ENTRYPOINT, so the CMD can define the handler path. |
Beta Was this translation helpful? Give feedback.
-
So apologies for semi-hijacking this thread but I just wanted to share that I had quite a bit of difficulty (day or so) trying to build and thought I'd share the solution/dockerfile that worked for me here in case anyone else is trying to build in a similar way and getting stuck. I used 'cdk deploy' rather than zip. Also 'cdk destroy --all' and 'docker system prune -a' came in handy to clean up images as out of space seemed to become an issue.
One thing that also helped working this out was building in debug mode -> the last few lines get changed to this (or some variant)
|
Beta Was this translation helpful? Give feedback.
-
https://aws.amazon.com/fr/blogs/aws/new-for-aws-lambda-container-image-support/
Beta Was this translation helpful? Give feedback.
All reactions