Questions tagged [aws-lambda-layers]

183 questions
17
votes
3 answers

Import libraries in lambda layers

I wanted to import jsonschema library in my AWS Lambda in order to perform request validation. Instead of bundling the dependency with my app , I am looking to do this via Lambda Layers. I zipped all the dependencies under…
Punter Vicky
  • 12,516
  • 39
  • 134
  • 241
14
votes
1 answer

Unable to import module 'lambda_function': No module named 'pandas'

START RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99 Version: $LATEST Unable to import module 'lambda_function': No module named 'pandas' END RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99 I'm using Windows 7 64-bit as the host OS. What I…
mnm
  • 1,695
  • 2
  • 15
  • 39
10
votes
1 answer

Are old AWS Lambda layers automatically removed? If not, how to delete them?

Upon reading of this article which discusses the main drawback of using AWS Lambda functions, I'm trying to avoid what the author had to deal with and perform some cleanup on my own code: "Lambda versions every function. We use the Serverless…
avazula
  • 370
  • 5
  • 18
8
votes
3 answers

Is it a good idea to use Python SQLAlchemy in AWS Lambda?

Amazon suggests to not include big libraries/dependencies in lambda functions. As far as I know, SQLAlchemy is quite a big python library. Do you think it is a good idea to use it in lambda functions? An option would be to include it as a Lambda…
8
votes
1 answer

Conversion failed: Some directories do not have execute permissions

I am trying to create a AWS Lambda Layer in AWS CloudFormation but happens an error: Layer conversion failed: Some directories do not have execute permissions; (Service: AWSLambdaInternal; Status Code: 400; Error Code:…
7
votes
5 answers

SAM build - does it also build layers?

I'm new to both lambda's and also SAM - so if I've screwed anything simple up don't yell :D. Summary: I can't get sam build to build a layer specified in template.yaml, it only builds the lambda function. Background: I'm trying to build a lambda…
Richard
  • 1,409
  • 1
  • 7
  • 25
7
votes
1 answer

Can I import typescript types from a Lambda Layer?

I am attempting to use TypeScript when building Lambda functions but hitting an issue when using a Lambda Layer which is also written in TypeScript. TypeScript does not recognise the /opt/nodejs/... import for my Layer (as it would running in SAM…
user3067870
  • 357
  • 3
  • 11
6
votes
1 answer

AWS: Layer code not found when using "sam invoke local"

I'm working on a sample AWS project that creates two lambda functions. These functions share common code from node_modules which has been placed in a separate layer (specifically AWS::Lambda::LayerVersion, not AWS::Serverless::LayerVersion). I can…
kshetline
  • 8,496
  • 4
  • 19
  • 44
6
votes
2 answers

How to downgrade the boto3 version in an AWS Lambda Function

I need to use my own version of boto3 inside a Lambda (Python 3.7). The version included in the Lambda default Python 3.7 env (1.9.42) does not support the use of Textract for one reason or another. To do this, I did the following based on a…
5
votes
0 answers

How to create a lambda layer with selenium 3 and firefox?

I have a working docker container and want migrate to a lambda layer for selenium 3.141 on firefox. Dockerfile for the working container is: FROM python:3.7-slim RUN /usr/local/bin/python -m pip install --upgrade pip RUN pip install…
peer
  • 3,061
  • 3
  • 19
  • 43
5
votes
1 answer

AWS Lambda layer has no execute permission

I create a lambda lambda for Python runtime (3.6 and 3.7 compatible) that contains a bin executable (texlive) But when I try to execute it through subprocess.run it says that it has no execution permissions! How can I make it so this layer has…
Mojimi
  • 1,651
  • 5
  • 30
  • 81
5
votes
3 answers

Latest Lambda Layer ARN

I have a lambda layer which I keep updating. This lambda layer has multiple versions. How can I find the lambda layer ARN with latest version using aws cli?
Punter Vicky
  • 12,516
  • 39
  • 134
  • 241
5
votes
4 answers

Is it possible to add paths to the PATH environment variable through serverless.yml?

When I create an AWS Lambda Layer, all the contents / modules of my zip file go to /opt/ when the AWS Lambda executes. This easily becomes cumbersome and frustrating because I have to use absolute imports on all my lambdas. Example: import…
Ericson Willians
  • 6,608
  • 10
  • 47
  • 97
4
votes
2 answers

Can an AWS Lambda Layer intercept a Lambda Function Handler, without the Function / Handler invoking the layer?

I'm researching the abilities of AWS Lambda Layers and trying to confirm whether the Layer can add behaviors without the Lambda Function having any knowledge / interaction with the layer. My understanding from the docs is that Layers are effectively…
STW
  • 40,454
  • 16
  • 100
  • 153
4
votes
2 answers

Python Layer Image Failing: "Unable to import module 'lambda_function': cannot import name '_imaging' from 'PIL'"

I'm simply trying to be able to use PIL in my Python 3.8 Lambda. I'm trying the following steps: Based on this repo: https://github.com/hidekuma/lambda-layers-for-python-runtime cd /mydir git clone…
Colin
  • 3,770
  • 16
  • 36
1
2 3
12 13