
Customers migrating to the cloud are often looking for the benefits of serverless architecture, like reduced operational overhead and automatic scaling. The idea of moving to a serverless achitecture can be daunting if you're new to the idea of serverless. Can one really migrate from a traditional web environment to serverless? Absolutely. In this blog post, we'll recommend ways to perform a "lift and shift" migration -- the fastest way to move a production workload to serverless.
The term "lift and shift" refers to a process of migrating an exact copy of an application or workload (with no/minimum modification), along with its required services (like databases and file systems) from one environment to another. Depending on your specific application, you may be able to lift and shift the entire application or only parts. Even if the migration is partial, it can begin to bring the benefits of serverless while enabling the development team to gradually refactor the remaining bits (e.g., using the strangler pattern).
In the next sections, we'll review high level migration steps that are applicable to nearly all runtimes and frameworks. Our example application will use an Mongo, Express, React, and Node.js (MERN) stack web app. However, the discussions presented in this post apply to other stacks too, including runtimes like PHP, Go, or Ruby.
Web apps hosted in a serverless environment benefit most from the capability of serverless applications to scale automatically and for paying for what you use. Imagine that you have a personal web app with little traffic. If you are hosting in a serverless environment, you don’t pay a fixed price to have the servers up and running you pay only when your app recieves requests. If your web app spends the majority of its time idle without receiving requests, using a serverless architecture can reduce your costs. This benefit applies to the opposite case. For an owner of a small ecommerce site running on a server, imagine if a social media influencer with millions of followers recommends one of their products. Suddenly, thousands of requests arrive and make the site unavailable. If the site is hosted on a serverless platform, the application will scale easily to accommodate the traffic that it receives.