UPDATE: You can save time and money if you don’t need HTTPS and you want to use a subdomain. In that case, you don’t need a Load Balancer. See the next note for more information.

In my previous post I wrote how I created this site and uploaded to AWS S3. For different reasons, I’ve decided to invest my time in getting familiar with Google Could Platform and besides some other little basic experiments, I wanted to move the page to Google Cloud Storage. The process has been quite simple as I’m finding Google documentation quite more detailed than AWS one.

All I did was follow the instructions on how to host a static site in GCP. I will highlight some points in the process below.

If you want to use your domain, you need to verify you “own” it. It is pretty simple, and if you follow the guide, it shouldn’t be a problem. Basically, you need to add a TXT entry in your DNS configuration. If your registrant (in my case GoDaddy) asks for a host for that entry, use @ for the domain itself.

Although I had the CLI tools for GCP installed already (after fixing my Python environment setup for one more time), I did some of the steps in the console. I find the console easier to use if you are learning, and many errors are better there and have follow up links.

Following the guide’s steps, I created the bucket in the console and uploaded the files using the CLI gsutil cp -r _site/* gs://notes.nestorlafon.com. My site is very simple and I didn’t looked at the rsync option this time.

Compared to AWS, setting up the permissions for the bucket is simpler, the guide and console are quite explicit. The same goes for setting the main and error pages. Where it becomes more complicated is when you want to link your domain to the bucket itself. For that, the guide tells you to create a load balancer.

Creating the load balancer is easy following the nice documentation. In my case I didn’t want to use HTTPS, and using HTTP makes some of the steps (related to certificates) irrelevant. Once you have your external IP, go to your DNS settings and create an A entry for your domain (o subdomain in my case).

Running the page in AWS was free, I’m unsure what would be the cost in CGP as their free tier is more restrictive, but nevertheless, the traffic and size of the page won’t make it an issue straight away.

For the following posts, I will see how to improve the files’ uploading to be just the changed ones and later how to use CI/CD to automate updating the site.