1 Answer
- Newest
- Most votes
- Most comments
0
What about using Amazon Linux2 to create layers?
As noted in the following documentation, it may not work well if created on a local Windows or Mac machine.
https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html
The first step to creating a layer is to bundle all of your layer content into a .zip file archive. Because Lambda functions run on Amazon Linux, your layer content must be able to compile and build in a Linux environment. If you build packages on your local Windows or Mac machine, you’ll get output binaries for that operating system by default. These binaries may not work properly when you upload them to Lambda.
The following blogs may be helpful.
https://canobertin.medium.com/ssh-with-aws-lambda-f7cea05a0cb9
Relevant content
- asked 2 years ago
- Accepted Answerasked 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
I am using Ubuntu and have created a layer on it. I have installed the library both locally and in a separate folder. Additionally, I compressed it into a zip file and created a layer. The library works fine locally but in lambda function it gives attribute error.
Try to create it using Amazon Linux2 or similar instead of Ubuntu.
I did it using Amazon Linux2 but still getting the same error. I have double checked the file and the code for "key = paramiko.RSAKey.from_private_key_file('EC2-Key.pem')", is present but somehow it cannot be accessed in the lambda function.
Lambda Function have full access of EC2, S3, right now I am testing it that why I have given full access