how to run Langage C code in a AWS Lambda? - amazon-web-services

I looking for documentation on official AWS: https://aws.amazon.com/lambda/faqs/?nc1=h_ls
I find this:
Q: What languages does AWS Lambda support?
AWS Lambda natively supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code, and provides a Runtime API which allows you to use any additional programming languages to author your functions. Please read our documentation on using Node.js, Python, Java, Ruby, C#, Go, and PowerShell.
I do not find this documentation API. I want find a simple programme read/write file in langage C. after I will want expose after a API gateway.

There are two solutions to that:
Develop your own custom lambda runtime for that. AWS provides some guides and examples of how to do it for C++ in Introducing the C++ Lambda Runtime
Use lambda container images which allow you to run docker containers (properly prepared) for your function.

Related

Best way to call AWS Lambda in C++?

I have an AWS Lambda and am creating a simple C++ application to call it.
Based on the AWS Docs, I went and installed the SDK here https://github.com/aws/aws-sdk-cpp but that seems to add nearly a full GB if I include the whole thing.
Is there something like boto3 for C++?
If not, what is the accepted best way of integrating Lambda calls into a small C++ application?
Is there something like boto3 for C++?
That's literally the thing you linked to. Boto3 is the AWS SDK for Python. This is the AWS SDK for C++.
What you are missing is that you can install just the packages you need from the SDK, instead of the full SDK.

Does AWS CDK support multiple languagues within a project?

If I am developing an app using the AWS CDK, can I use one language for the infrastructure and a separate language for my lambda code?
For example, can I create buckets, rules, lambdas etc. with typescript, but then deploy python code within the lambda? Especially considering I may need to pass a newly created bucket to the python code.
You can certainly do this. If you take a look at the "serverless" examples for CDK, you'll see that for all of the supported languages the Lambda that is created is built in Node. The Java examples, for example, includes ways to build with the Java CDK and, inside of the project, include the JavaScript code. Python and C# are very similar.

In Firebase how do I run C++ in functions?

I want to run C++ code in the backend, so in functions. Does anyone know how?
The question is generic on purpose, because I do not care how the code is built or called.
My initial thought was calling a C++ lib in nodejs, using FFI. I am still working on it, but I want to explore other options.
Nevertheless, my searches always lead to C++ projects running on the client side, and that not what I am looking for.
If something is unclear, please ask.
Your help will be much appreciated.
As mentioned by Dharmaraj in the comments,
As far as I know, you can use only Javascript and Typescript in
Firebase Cloud Functions. Though you get more options like python, go
and a few more in GOOGLE Cloud Functions.
the only available language (as standard) in Firebase Functions/Hosting is JavaScript (NodeJS) or TypeScript. There are a few ways out there that attempt to make languages such as PHP work, however I will not link any as I have never tried any.
Google Cloud does offer a server environment with languages such as Go, Python, PHP (potentially C++), as opposed to a serverless environment that Firebase Functions runs in. A serverless environment means that code cannot automatically run in the backend and must be called via HTTP request, pub/sub or cron job.

Migration of Lua REST microservice to AWS Lambda

On my project I have few microservices written on Lua which are hosted on Heroku. Currently we are migrating to AWS and as part of that migration we are looking for ways how easier to migrate our Lua services. I know that we could take usual EC2 for that purpose, but I'd like to try find some more cost-effective solutions.
As AWS Lambda by default does not supports Lua language for writing functions I'm interested in what's the easiest way to migrate my existing Lua services to Lambda? Maybe does it make sense try to run it on some of JVM implementation for Lua (like luaj or Rembulan) or it will be better just rewrite our services on something what's supported by AWS Lambda (like Python or Go)?
You can use Lua bindings from some other language.
Nice approach we tried was using Rust bindings (https://github.com/kyren/rlua) and AWS also supports Rust runtime (https://aws.amazon.com/blogs/opensource/rust-runtime-for-aws-lambda/)

Is it possible to use PHP to code an Amazon Lambda function?

Is it possible to use other languages aside from Node.js, Python, Java, and C# with lambda?
Natively AWS Lambda supports only following languages
Java 8
C#
Edge Node.js 4.3
Node,js 4.3
Node.js 6.10
Python 2.7
Python 3.6
However, if you want to use PHP, you can still do that with a bit of a workaround as outlined in the blog Scripting Languages for AWS Lambda: Running PHP, Ruby, and Go.
you need to upload php binaries (php executable, .so files etc) and ini files as part of your lambda deployment.
one good option for doing this is https://serverless.com/
and then you need something to manage the execution of the php functions.
check this out: https://github.com/niron1/serverless-php-lambda
(I'm the author)