Static Website assets through cloudfront with dynamic index.html

What is the best way of deploying a Single Page app with a dynamic index.html page built through lambda.

The app is currently being served through CloudFront with the S3 bucket origin and a static html page.

I want to serve different index.html depending on our client’s domain name which will be pointing at this deployment.

You’re basically looking at 1x CDN and S3 per site if you want unique index pages. You could then choose to prerender your routes or not.

A more advanced solution where you can have multiple routes, index pages and domains you would likely need to use Lambda@Edge to handle the routing.

You could either hard code it, or implement something like this…

Full disclosure, I wrote it to make things like this dead simple.

Thanks @iDVB, I’ll take a look at the reroute option.