Tutorial
How to run WordPress Serverless
Rahul Biswas December 3, 2020
My other blog is completely serverless and in this post I will go through the steps (briefly), pros and cons to hosting and setting up a serverless blog yourself at a cost of $0 per month.
Domain + SSL
01.
S3 Storage
02.
Cloudfront
03.
DNS with Route53
04.
Steps to be followed
Domain + SSL
01
Go to Route53, Register Domain and then go through the steps, fill in your info and purchase. After purchasing the domain, AWS will verify your email and create your hosted zone. Next we need to create the SSL Certificate in the Certificate Manager. Make sure that you are in the N. Virgini region. Go to Certificate Manager, Request a Public Certificate, then specify a record for the domain and wildcard
S3 Storage
02
Now let’s setup our 2 S3 buckets. The first one will be the origin for the CloudFront(CF) Distribution and then the second one is a “hack” so that we can redirect our domain to CF as well. First create the origin bucket, I like to use the FQDN (Fully Qualified Domain Name) as the name, so for example: http://www.domain.com.
Cloudfront CDN
03
Now for the second last part, we need to create the CF (CloudFront) Distribution. Go to CloudFront, click Create Distribution, under the Web section click Get Started. This is a lengthy form, and I usually miss at least 1 setting and then have to go back and edit it later. For the Origin Settings, select the origin S3 bucket that we setup earlier (FQDN name, so http://www.domain.com), the Origin ID will be pre-filled, leave the rest of that section as is.
DNS with Route53
04
Go to Route53 in the console, click on your hosted zone and then Create Record Set. On the left a pane opens, make the Name field the name of our host www, then choose the Type as A-IPv4 address and choose Alias, then select the Alias Target (AWS Service) that has the domain name of the CF Distribution we just created. Create the record, it has no TTL, but give it +- 3mins to propagate.