Search code examples
node.jsreactjsaws-lambdaserverless-frameworkreact-starter-kit

Deploy Isomorphic react starter kit to AWS Lambda


I'm a newbie when it comes to Node.js nad React.

I'm trying to deploy React Starter Kit — "isomorphic" web app boilerplate to the cloud. I'm currently using heroku, but I've read that I can do this using AWS Lambda and API gateway. I tried to do this using Serverless framework and also do this on my own but didn't succeed.

Running the serverless framework using a webpack plugin failed because my webpack file is written in ES6 and I don't know how to run babel before webpack (locally, I'm running babel-node that calls webpack).

As for doing this manually- I couldn't find instructions for the starter-kit setup - should I upload the entire folder to S3? how to define the lambda function? do I need to change something in my current code?

Any help would be appreciated.


Solution

  • AFAIK, there isn't a direct way to use that isomorphic starter kit on Lambda. AWS Lambda and API Gateway can help you set up a serverless backend. And you can host your React app statically on S3. Here is a fork of the starter kit that you linked to, that does exactly that - React Static Boilerplate

    There are ways to server side render your React app on Lambda but they are a bit cumbersome and not very straightforward. Here is an article outlining some basic aspects of it - Rendering React with Amazon Lambda