First Post
Hello world on Cloudflare pages.
My static site originally hosted in AWS and now hosted in Cloudflare pages.
The old setup works and it was for my learning. Since then I have not maintained the setup or content. AWS charges were too much to leave it alone. Hosting the site on Cloudflare pages or Github page is free (aside paying for the domain).
The old setup
There were a couple of services necessary for the setup in AWS to securely serve a static site. They are
- Cloudfront, neccessary if you want to securely serve content via SSL since S3 do not support TLS/SSL
- ACM, provisioning TLS/SSL on Cloudfront
- S3, as the storage for the assets, and
- Route 53
Other requirements (not using AWS) are
- Domain (Godaddy) and
- Hugo, static site generator
The new home
I was curious with Cloudflare products, e.g. Pages, Worker, R2 and etc. Migrating the site to Cloudflare would probably allow me to expand my “PoCs” with its product in the future.
Secondly, Cloudflare offer domain which they offer “At-cost pricing”. I might want to transfer my current domain registrar, GoDaddy, to Cloudflare just to keep the cost to minimal. But, for this exercise, I will keep GoDaddy as the primary DNS.
The move
The move was relatively easy, these are the general steps that I have taken
- Create a Cloudflare account
- Install wrangler to deploy my site via CI/CD or CLI
- Create an Cloudflare API token to enable step 2
- Reset GoDaddy’s nameserver to default. (I had replace with route53 nameservers in my old setup)
- Publish my assets to Cloudflare pages
- Add custom domain to Cloudflare pages project
- Add Cloudflare custom
CNAME
record on GoDaddy - Cleanup AWS resources
The renovation
Future changes that I might make is to introduce dagger as the CI/CD tool.
The current approach requires me to install wrangler and publish the site via CLI. Using dagger
would allow me to provision and run this setup in a reproducible manner.
Updated since 13-Oct-23 Published using dagger.