How to execute c# code via lambda function aws written in node.js
Clash Royale CLAN TAG#URR8PPP
How to execute c# code via lambda function aws written in node.js
I have to write a Lambda function in node.js to execute my C# code. Can anyone suggest how can I do.
Currently I am doing the same thing for Java which works fine. So to run java code I have first installed jdk and then set the path and then used gradle to compile and run the java code. This all code I have written in node.js in AWS lambda.
1 Answer
1
Curious why you wouldn't just use the .NET Core Lambda runtime.
Assuming there is a good reason not to do use the .NET Core Lambda runtime I believe what you would want to do is package the C# code as a self contained application. That can be done using the following command.
dotnet publish --configuration Release --self-contained --runtime rhel-x64
dotnet publish --configuration Release --self-contained --runtime rhel-x64
Then zip up the publish folder and include it with your node.js. You need to handle the file permissions once extracted. There will be one file named the same as your project with no extension and that should be given the +x permission and that is what you will execute.
You might have to experiment with the --runtime
field if you are getting dependency issues and try other possible runtimes. Here is the possible list of runtime identifiers. https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
--runtime
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.