Introducing Serverless-Multi-Region-Plugin

We use the serverless framework on one of my projects at work. Now, deploying serverless is a piece of cake, but we needed to deploy serverless in an active-active multi-region failover setup to meet the needs of our disaster recovery.  The setup we want kinda looks like this:

So as usual, I started by trying to use something that was out there.  And I found “Serverless-Multi-Regional-Plugin“.  Just one problem…it didn’t really work.

It was a good start, but it left a number of things out. It didn’t set up the API Gateway base path properly, it wasn’t set up to await the outcome of the API being deployed, and it also didn’t set up health checks to allow the fail-over to occur out of the box.  The setup also required a lot of properties to be explicitly set that I just wanted to be derived from the host name. In addition, there were no unit tests in the project.  That being said, it was a great start to build from.

So I basically added all the things I mentioned.  I allow almost everything to be derived from just a couple of settings if you have a domain name set up and a certificate registered. But…I also allow all of the original settings to explicitly override the settings derived by convention.  I also automatically added in some default health checks and set up the base path of the CloudFront so that everything just works. And finally, I added a bunch of unit tests to make sure all of the core configuration settings actually did was I expected them to do.

After completing all of this work, of course I put in a PR….but no response. I guess the maintainer of the project has let it go. So I tweaked the name a bit, and now we have:

Serverless-Multi-Region-Plugin!! I know, very original.

Check it out, use it, improve it!

NPM: https://www.npmjs.com/package/serverless-multi-region-plugin

GitHub: https://github.com/unbill/serverless-multi-region-plugin