DEV Community

Discussion on: Serverless Static Wordpress on AWS for $0.01 a day

Collapse
 
rehanvdm profile image
Rehan van der Merwe

Nice, I wrote something similar a few year back rehanvdm.com/serverless/serverless....

Except back then I wasn't big into IaC. The main difference is that I have the whole WordPress setup on an EC2 instance. Then just start it when I am writing a blog, then exporting the static content, also using WP2Static and then shut it down again.

Then I deploy locally by extracting the static zip and running a few Gulp scripts to do post processing like compressing images, and a few HTML and IP replacements. Then I just do an S3 sync.

Collapse
 
petewilcock profile image
Pete Wilcock

It's really interesting @rehanvdm because if the plugin (or a fork) could be customised for true AWS-native deployment, the publish step could be incredibly fast and scalable, and not rely on running within the Wordpress installation at all. I've discussed this a bit with @leonstafford and I really like the idea - I just don't have enough (any) experience in building Wordpress plugins so I can't do this myself!

Collapse
 
rehanvdm profile image
Rehan van der Merwe • Edited

I have limited experience with WP Plugins, just don't have capacity atm. If I were to do it over again now, I will defintley not use Wordpress at all. Back then I didn't know how/what is involved in running your own blog. Things like OpenGraph tags, social media sharing buttons, how to do "recomendation" blogs based on current, SEO related configs.

*When I am doing the next face-lift change I will defintley move to a Vue + Markdown type of solution. The image compressing is also an extremly CPU intensive task that runs on my local machine, so I will also move that to some CI/CD pipeline running on the cloud.

Glad to see the Plugin is still active, great write up!

Thread Thread
 
petewilcock profile image
Pete Wilcock

I'm using Smush for image-optimization which is pretty good, although sadly S3 doesn't appear to understand the mime type of WebP by default, and the S3 addon for WP2Static doesn't (yet) have an option to specify your own metadata based on file type. Still many, many optimizations left to exploit :)

Thread Thread
 
rehanvdm profile image
Rehan van der Merwe

Thanks for the mention, haven't really looked at doing image optimization on WP, might transition to that. Currently using npmjs.com/package/gulp-imagemin.

I will soon do something similar to this medium.com/nona-web/converting-ima... to do optimization on the "fly" for one of the internal company projects.

Thread Thread
 
petewilcock profile image
Pete Wilcock

Oh now you've got me thinking about a Lambda@Edge integration to rewrite any jpg/png requests to a generated WebP version, I could even fix the metadata in the response to guarantee it works! adds to list

Thread Thread
 
rehanvdm profile image
Rehan van der Merwe

That's exactly the plan :) Also if you just want to change metadata/headers look into the newly released CloudFront Functions, those are less expensive and a perfect use case for header rewrites etc.

Some comments have been hidden by the post's author - find out more