5

Half serverless blog with react front end

I want to host a scalable blog or application of this sort in nodeJS on AWS making use of AWS technologies. The idea here is to have a small EC2 server that is not responsible for serving the website, but only for running the CMS/admin panel. While these operations could be serverless as well, I think having a dedicated small VM EC2 instance could be more efficient, and works better with existing frameworks, etc.

In my diagram above, you can see there's two type of users audiences and admin/writers. Admin CRUD operations also cause lambda to run. Lambda generates the static site after Admin changes, which is delivered to S3. Users are directed to the static site hosted in S3. Only admins/writers have access to the server-connecting part of the site.

I think this is a good design for an extremely scalable and relatively cheap site, as long as the user-facing side is all static. An alternative to this is a CDN, but then I have to deal with cache invalidation issues, a site that updates slower, and a larger server.

This seems like a win-win to me. Feedback?

Mark B
  • 183,023
  • 24
  • 297
  • 295
novasaint
  • 700
  • 8
  • 13
  • 2
    There's nothing wrong with this design. You're basically building a static site admin that runs on EC2, and a static site generator that runs on Lambda. You might also just run the whole thing on EC2. Are you building this all from scratch or using existing static site tools? You might want to look at an existing static site generator that runs on Lambda like this: https://github.com/ryansb/hugo-lambda – Mark B Aug 04 '16 at 02:45
  • 1
    As Mark B said you're essentially building a simple static site that happens to allow some customization but doesn't support any back-end logic whatsoever. As long as all you care about are some mostly static content pages then the design is OK. – Mike Dinescu Aug 04 '16 at 05:24
  • How often your site content is updated? – Harshal Bulsara Aug 04 '16 at 05:38
  • @MarkB Thanks for suggesting hugo-lambda, very helpful. I am thinking of using a static site generator as well. I can put that on EC2. I am not sure how large the site will get. I think if the site will get large I should put that on lambda and let lambda does the heavy lifting and scaling. – novasaint Aug 04 '16 at 06:43
  • mike Yes the audience of the sites won't touch the back-end logic. Just static pages with pictures and videos. @harshal I don't know exactly how much yet but I assume it's not more than 1000 per day. – novasaint Aug 04 '16 at 06:44
  • This reminds me a lot of a project I've been wanting to take on myself. Basically I've been wanting to take a CMS with a good UI like Pencil Blue and add static site export capabilities using Lambda. Alternatively, adding a nice admin UI to a static site generator like Hugo would be another way to approach the project. Your AWS diagram looks exactly like what I was thinking. – Mark B Aug 04 '16 at 14:14
  • Also, there are some "content management as a service" companies out there, like contentful.com, that give you the admin UI and database, and static site generators like Hugo can be driven by that data and triggered when changes occur. You have to pay for the service though, I don't know of any you can run on your own server. – Mark B Aug 04 '16 at 14:17
  • I like the design. – stevepkr84 Aug 05 '16 at 13:15

1 Answers1

0

This ought to be a comment rather than an answer, but as I don't have enough points...

There are a couple of other considerations for this architecture. Lambda functions are great for scaling out microservices horizontally with each small function being executed in parallel tens or hundreds of times. Generation of a static site is typically a single threaded operation so you may not see the gains you expect, you'll also need to watch the timeout period (maximum 300 seconds currently) and make sure that you can generate the site in that time. Of course if you are not running Lambda code you are not getting charged.

For your admin frontend I would suggest ElasticBeanstalk, even if you peg it at a single instance, it gives you lots of great features like rolling updates.

Good luck with the project.

Lucifer
  • 21
  • 5