git-lambda-layer icon indicating copy to clipboard operation
git-lambda-layer copied to clipboard

Support for using layer.zip with AWS Lambda containers

Open jmjava opened this issue 4 years ago • 7 comments

I realize this probably out of scope

We have a Python lambda that runs from the AWS lambda container

FROM public.ecr.aws/lambda/python:3.8

We are running into the issue with git clone command.

PRIV_END: seteuid: Operation not permitted

I have tried setting the environment variable but this is not working

ENV GIT_SSH_COMMAND='ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no'

I see you have the layer.zip with all the binaries - would it be possible to share instructions on how to use this in the lambda container? Do I merge the files into the respective folders in the container?

thanks for any reply - this is the only place I have found where there seems to be a solution for this problem

jmjava avatar Jul 21 '21 18:07 jmjava

This instructions for using are in the README: https://github.com/lambci/git-lambda-layer#getting-started

mhart avatar Jul 21 '21 19:07 mhart

Hi thanks. I am not using the basic lambda but a lambda container. Can I use a layer with a lambda container? Right now I am just taking the zip and unzipping to /

(this is not tested yet just a guess on how to do this in container)

RUN unzip -o /opt/layer/layer.zip -d /

jmjava avatar Jul 21 '21 19:07 jmjava

SAM CLI supports layers in lambda containers if you want to run locally. https://aws.amazon.com/blogs/compute/working-with-aws-lambda-and-lambda-layers-in-aws-sam/

mhart avatar Jul 21 '21 19:07 mhart

Unfortunately, this is part of CDK application and I have the lambda container in CDK custom control.

I was able to get a bit further by adding this to my docker file

RUN mkdir /opt/layer

COPY layer/layer.zip /opt/layer

RUN unzip -o /opt/layer/layer.zip -d /

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib

ENV PATH=/bin:$PATH

but it seems the binaries from the layer.zip are trying to create a new directory?

[image: image.png]

On Wed, Jul 21, 2021 at 3:55 PM Michael Hart @.***> wrote:

SAM CLI supports layers in lambda containers if you want to run locally. https://aws.amazon.com/blogs/compute/working-with-aws-lambda-and-lambda-layers-in-aws-sam/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lambci/git-lambda-layer/issues/32#issuecomment-884456791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQPB3BYD3XDZA6OCPRMWLTY4Q2PANCNFSM5AYRL5DA .

jmjava avatar Jul 21 '21 20:07 jmjava

Doing the same thing as what SAM CLI does is probably your best bet. Mount the layer in your docker container under /opt – it'll be somewhere in their source code (they might have documentation for this?)

mhart avatar Jul 21 '21 20:07 mhart

Ok thanks Michael. Appreciate the help - your work at least is a start here.

Thanks again for the reply - this can be considered closed.

I will update with any comments if I finally get it running.

-john

On Wed, Jul 21, 2021 at 4:34 PM Michael Hart @.***> wrote:

Doing the same thing as what SAM CLI does is probably your best bet. Mount the layer in your docker container under /opt – it'll be somewhere in their source code (they might have documentation for this?)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lambci/git-lambda-layer/issues/32#issuecomment-884481122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQPB3AU32VNEOZVBVHZ4TTY4VMVANCNFSM5AYRL5DA .

jmjava avatar Jul 21 '21 21:07 jmjava

@jmjava Any update on if you got this to work with your containerized lambda?

jimwelagu avatar Jun 22 '22 00:06 jimwelagu