Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, Is it possible to add the ARN of the Lambda Layer to my AWS Lambda Container Image #37

Closed
iamcristos opened this issue Aug 20, 2021 · 1 comment
Assignees
Labels
lambda Lambda related issues question Further information is requested

Comments

@iamcristos
Copy link

For more context, I'm AWS lambda Container Image to handle my lambda function

@alolita alolita added lambda Lambda related issues question Further information is requested labels Dec 19, 2021
@NathanielRN
Copy link

Hey @iamcristos !

This sounds like an interesting use case. I went online and found this blog post in the "Copy the contents of a Lambda layer into a container image" section which discusses steps that I think will be helpful to you.

For example, if you are using OTel Python Container images, you would want the OTel Python Lambda Layer ARN. Then, you could do

curl $(aws lambda get-layer-version-by-arn --arn arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python38-ver-1-7-1:1 --query 'Content.Location' --output text) --output layer.zip

to get the contents of the Lambda Layer and add them to your Lambda function.

Another solution is to create the Lambda function with the Docker Image, and then use the aws cli afterwards to add the Lambda Layer. This is also explained in the blog post.

aws lambda create-function --region us-east-1 --function-name my-function \  
    --role arn:aws:iam::123456789012:role/lambda-role \
    --layers \
        "arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python38-ver-1-7-1:1" \

Otherwise, if you were looking for a setting that added it at once in the Docker Image it seems that the Docker Images don't support that. If that is a feature you want to request I recommend looking at the aws-lambda-base-images GitHub Repository where you can voice your use case 🙂

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lambda Lambda related issues question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants