Level / leveldown

Pure C++ Node.js LevelDB binding. An abstract-leveldown compliant store.
MIT License
775 stars 177 forks source link

Installation on AWS Lambda #286

Closed fergiemcdowall closed 6 years ago

fergiemcdowall commented 8 years ago

Has anybody attempted to install leveldown on AWS Lambda? If so how did it go? What is the best strategy for installing the binary?

bhurlow commented 8 years ago

Does lambda preserve the disk state between invocation? I would imagine Amazon rotates the location of the functions pretty heavily in the background so they're probably 'stateless'

fergiemcdowall commented 8 years ago

For my use case it is fine if the instances are ephemeral.

I guess another way to formulate the question is: is there a standard way compile and distribute prebuilt binaries for node modules so that you can deploy bundles without npm installing?

bhurlow commented 8 years ago

http://apex.run/#function-hooks might be helpful

juliangruber commented 8 years ago

leveldown is installed via prebuilt already, so an npm install on aws should just fetch those

vweevers commented 6 years ago

I guess another way to formulate the question is: is there a standard way compile and distribute prebuilt binaries for node modules so that you can deploy bundles without npm installing?

We're looking into prebuildify (#482), which would include all prebuilts in the npm package, and therefore in the AWS deployment package.

Short of that, there is no standard way.

LinusU commented 6 years ago

@fergiemcdowall you can compile the module inside a docker instance that matches the AWS Lambda runtime, then simply include that in your zip file that you upload to Lamda. That's how I've solved native dependencies in scandium.

fergiemcdowall commented 6 years ago

@LinusU nice! I will give it a try.

LinusU commented 6 years ago

@fergiemcdowall here is the docker file, in JS though 😆, but should be easy to see what it does.

https://github.com/LinusU/scandium/blob/master/lib/dockerfile.js

vweevers commented 6 years ago

FROM amazonlinux:2017.03

Nice one! Didn't know they had docker images :)

LinusU commented 6 years ago

Yeah, it's nice! It's also pinned at 2017.03 since the Lambda documentation says that that is the version that they are running at the moment.