Deploy to multiple cloud providers

Hi,

I have a serverless function that I’d like to deploy to AWS as well as Azure.
My idea was to have a common codebase and then call those from provider-specific handler scripts.
Any suggestions on how to handle the two different serverless.yml files?

Thanks,
Daniel

You’ll need at least three projects. One for each platform with platform specific function handlers and their own serverless.yml. A third one with platform independent business logic. If you’re using Node then I’d implement this as a private NPM package.

You’ll also need an abstraction layer for storage, message queues, etc so that your business logic doesn’t end up with platform specific code in it. I’d try to inject this into your business logic from your platform specific handlers.

Hi buggy,

thanks for you reply. I really like the suggestion of using private npm packages for this. As I’ve already set up a local npm server, this will be the way to go.

Still, I think it would be neat if the Serverless CLI had an option to set a specific yml file. This way, a user could keep 2 different configurations in the sam project folder and decide for each deployment which one to use.

1 Like

FYI: There’s a PR in progress to address this as a CLI option.