srijs / rust-aws-lambda

Support for running Rust programs on AWS Lambda
https://srijs.github.io/rust-aws-lambda
MIT License
319 stars 17 forks source link

Readme is unclear about project #18

Closed oceanlewis closed 6 years ago

oceanlewis commented 6 years ago

What I mean to say is that, there are ways to run Rust code inside of a Lambda by embedding the code inside of a Python or Node project and calling into that. From my understanding, Go interacts with the Lambda environment directly via a RPC calls (read that somewhere, don't quote me). Does this library attempt to do the same? RPC calls directly to/from Rust Land?

It's not clear from the README what the case is.

LegNeato commented 6 years ago

Yes, this uses the aws go runtime. The go runtime is special in that it runs a binary and calls into it using gob encoding over rpc. This project reimplements gob encoding over rpc in rust and responds to lambda as if it were written in go, which should be as fast or faster than native go.

It should be the lowest overhead way (cpu, memory, time) to run lambda functions in rust though we haven't published benchmarks.

It also means development and deployment is trivial just like go. Build a normal rust binary, upload it, choose go as the lambda language and everything just works.

oceanlewis commented 6 years ago

That. Is. Awesome.

LegNeato commented 6 years ago

Indeed, thanks! 🍻 @srijs did all the heavy lifting, I threw most of my code away 😅

oceanlewis commented 6 years ago

Hmm, I'm using https://github.com/srijs/rust-aws-lambda/blob/master/aws_lambda/examples/hello.rs as a test, but I'm getting the following error. Is there anything else I need to do other than build a binary and run it in the go runtime?

{
  "errorMessage": "fork/exec /var/task/rust-lambda-test: exec format error",
  "errorType": "PathError"
}