Yes, I have enjoyed over-complicating my website architecture to keeps my boredom low, but I also made it a cheap solution for $2.06/month. I anticipate that I could grow my website readers by 5,000,000 people a month and my costs would remain roughly the same.
Okay, I don’t like the word “cheap” so I will describe my solution as very frugal. When I decided to start writing a blog I wanted the most frugal option available. I did lots of googling, tried software like Jekyll, Gatsby, Hugo and even Eleventy. Those tools and approaches relied too much on a local development machine, a technical approach I didn’t like or didn’t provide enough out of the box for options/features for me. So I ended up using the framework, community and extensibility of WordPress and created my own solution that works fairly well. Those that know me well, just saw me shutter because as a developer for 25+ years, I would never chose this framework as my preferred technology stack… However, please keep reading to find out the result of my efforts.
Hosting the WordPress framework. As you know, WordPress is built upon a LAMP stack and requires a server to function. However, that functionality is primarily used to author and publish the posts and pages, it is not needed once the HTML is created. So I only use WordPress to author my content, not to serve my content. My steps to get the WordPress site up and running:
- Logged into my AWS Console
- Went to the Amazon Marketplace to find a WordPress Amazon Machine Image. I did this to minimize my effort in getting this setup manually.
- I then went to Route53, created a subdomain: edit.comingdeer.com and pointed it to the new EC2.
- Once the EC2 was running I logged in with admin credentials, selected a theme and started creating content.
- Once I was ready to publish out my first version of my blog I installed and configured these plugins:
- Next, I ran the Static Site Generator and copy those artifacts to the S3 bucket
- I then setup a CloudFront endpoint and pointed it to the S3 bucket that is hosting my static pages
- Then went to Route53 and pointed the apex and www records to that Cloudfront endpoint.
- I also used Amazon Certificate Manager to create a free SSL certification and assigned it to CloudFront.
- So now I have https://www.comingdeer.com alive, cached on Cloudfront and pointing to my S3 bucket
- Once that was all working, I stopped the EC2 instance (to reduce costs) and let it sit idle in my account. Whenever I want to make another blog post, I login to AWS, turn on the EC2, write my blog, generate the HTML, publish the files and turn off the EC2 again.
Can I get comments please? Next, I really wanted to give people the ability to provide feedback and comment on my awesome blogs. However, the WordPress framework requires PHP and a server to process and accepts comments. Again, I’m super frugal so I didn’t want to pay for a hosted solution like WordPress Comments, Disqus, Discourse or other static site commenting systems. I am also a bit geeky, so I decided to create my own commenting system using Lambda, API Gateway, DynamoDB and SES. This was a serverless technology stack that would help me keep my costs low. Here is what I did:
- I documented the data model I wanted: ID, URLSlug, Name, Email, Comment
- I created 2 Lambda functions: CreateComment and ReadComment
- I created 2 API Gateway endpoints to expose my Lambda functions to the public (with a security token of course)
- I created a DynamoDB table to store my comments, based on my data model above
- I wanted to be notified when a new comment was posted so I created a DynamoDB stream and triggered another Lambda Function (SendCommentEmail) to send me an email when a new comment was inserted into the DynamoDB table.
- The SendCommentEmail Lambda function uses SES to send the comment to my email so I can see who is commenting.
Does my audience only read English? Why not add some additional consumption methods to my blog since it’s easy. I used the AWS WordPress plugin to utilize AWS Transcribe and AWS Polly to convert my content to audio and multiple languages. I think it cost me less than 1 cent for every 10 blogs I post.
Nobody is finding my blogs? Now that I have a few posts out there I wanted to get my thoughts socialized and start gathering feedback from like-minded or opposing folks. However, the search engines didn’t know my website existed. So I needed to submit a Sitemap.XML file and make my website SEO friendly. Here is what I did:
- Installed Sitemap creator. However I found out that it requires the server-side code to generate the XML file on the fly, so it didn’t work… Right now I ended up manually creating my Sitemap.XML file and uploading it every time I make a new post… if you have a better solution, let me know!
Here is the current architecture of my blog (FYI: AWS – the new icons that are monochromatic are very boring, we want colors please!).
So it has been running now for a few months, what is the costs? See below for a breakout of my costs:
|API Gateway||$0.00 (Free tier)|
|Lambda||$0.00 (Free tier)|
|DynamoDB||$0.00 (Free tier)|
|CloudFront||$0.00 (Free tier)|
|Certificate Manager||$0.00 (Free tier)|
|SES||$0.00 (Free tier)|
|Polly||$0.00 (Free tier)|
|Transcribe||$0.00 (Free tier)|
|All WordPress Plugins||$0.00|
Thanks for reading, if you want a site setup like this, reach out to me and I can walk you though my setup in more depth.