How to Deploy a Lambda Layer Created in .NET 6.0 & C# Using AWS CDK? #27271
Unanswered
vishal-shah-25
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to deploy a Lambda Layer created in .NET 6.0 and C# using AWS CDK, but I'm encountering some challenges. I've noticed that I can deploy the layer using the
Amazon.Lambda.Tools
and the dotnet CLI with the following command:dotnet lambda publish-layer --layer-type runtime-package-store --s3-bucket bucket-name
However, when I attempt to do the same thing with AWS CDK, I run into issues. Specifically, the Lambda Layer I deploy via the CDK does not seem to work as expected.
I also found that when deploying a Lambda Layer using the CLI with the runtime-package-store layer type, it requires setting the Lambda environment variable DOTNET_SHARED_STORE to '/opt/dotnetcore/store/' so that it can access the layer's DLL files. Without this environment variable, Lambda functions may encounter errors while running.
Now, here's where it gets interesting:
Some of the reference links I came across: (All using cli command, not cdk)
https://github.com/aws/aws-extensions-for-dotnet-cli/blob/master/docs/Layers.md
https://github.com/awsimaya/Lambda-Layers
https://aws.amazon.com/blogs/developer/aws-lambda-layers-with-net-core/
Here's a snippet of the code I'm using in my AWS CDK project:
What am I missing or doing wrong in my CDK deployment?
If anyone could kindly provide a reference link or a code example detailing how to achieve these tasks within AWS CDK, it would be greatly appreciated!
Thanks,
Vishal
@aws-cdk-automation
Beta Was this translation helpful? Give feedback.
All reactions