lambdr
lambdr copied to clipboard
Serverless integration
Hi @mdneuzerling!
Thanks a lot for the amazing tool you put together! I just started today playing around with it – it is great.
I usually use AWS lambda for deploying JS functions, and serverless is simply great for deployment. One of the great advantages is to define function-level memory allocation, timeout, etc, in a yml
file.
I have just successfully deployed a function using {lambdr}
and serverless
as a test to see how it works. It turns out it seems to work great. Would you be interested in adding a function to simplify this integration? I can happily make a PR, let me know.
Best, Felipe
Hi @fmmattioni. I'm glad you got it working so quickly! That's a good sign.
It might just be because it's early in the morning here and I'm a little slow before my coffee, but could you please help me understand what you want to raise a PR for? Would I need to include a serverless
integration in lambdr
, or would lambdr
need to be integrated into serverless
?
Either is fine with me. And the projects are both MIT-licenced so there shouldn't be any issues there.
hey @mdneuzerling,
It would be simply a function to automate the creation of the yml
file with a few instructions on how to install serverless and set up an AWS profile to deploy it (or use root). I was thinking something like lambdr::deploy_serverless()
, which would then create the yml
skeleton and that is basically it.
@fmmattioni would you mind sharing your serverless config? im working on this now and have a hit a few snags (very new to R)
any files and folder structure would be super helpful
@dwbelliston sure! Please, see below a minimal example. I unfortunately still did not have the time to create a PR for @mdneuzerling, but this should get you started.
This uses API Gateway, by the way.
serverless.yml
:
service: my-lambda-function
frameworkVersion: '3'
provider:
name: aws
lambdaHashingVersion: 20201221
ecr:
images:
appimage:
uri: [insert url of your docker image deployed in ECR here]
stage: dev
region: us-east-2
profile: my-aws-profile
httpApi:
cors: true
apiGateway:
binaryMediaTypes:
- '*/*'
functions:
handler:
timeout: 25
memorySize: 1024
image:
name: appimage
command:
- handler
events:
- httpApi:
path: /handler
method: get
Guys, you need any help writing a PR? My team uses serverless to deploy code written in python, but we'd definitely prefer to use R.
Hi @pedrocava! Yes, feel free to start the PR 😄
I think we should first have a specification for what should be implemented. A very minimal approach would be to generate the provider.ecr
component and then let users do as they please with the resulting file. @mdneuzerling, @fmmattioni?