Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch provider serverless framework?

I’ve deployed some functions using Serverless framework on AWS Lambda. I would like to switch provider to IBM Functions, because they’re using OpenWhisk and it’s a really cool open source project backed up by apache.

I assume just changing provider in the yml won’t work because openwhisk functions have different signature then lambda. Also, I’m using the context object in my functions, but openwhisk doesn’t pass it as a parameter.

How can I do this switch? (or should I say migration?) Why does it say that Serverless is cloud agnostic if I cannot just switch to another provider in a transparent way?

Thanks in advance!

like image 259
Or Harel Avatar asked Feb 13 '18 11:02

Or Harel


1 Answers

The Serverless framework is a tool that handles all of the time-consuming tasks that you would otherwise need to perform manually using the web console and lets you quickly install the handler functions on the infrastructure of a given provider, but it doesn't actually convert those functions in any way, which you can see when you see those functions in the AWS or Azure web console (I assume that's also the case with IBM but I haven't used that provider yet).

It means that whenever there are any differences between providers - like different context objects, different event data, different ways to respond to requests etc. - you currently need to handle those differences yourself.

This is something that surprised me as well when I first found out about it and my idea was to write a simple abstraction layer that would handle those differences between AWS and Azure, and write handlers to that common abstraction instead of the target provider.

If that is something useful for others then I think I might open source that micro-framework for the Serverless framework.

But the bottom line is that to my best knowledge, at the time of this writing, the Serverless framework itself doesn't handle the differences between functions deployed to different providers. Please correct me in the comments if I'm wrong.

like image 163
rsp Avatar answered Oct 05 '22 11:10

rsp