4

I'd like to set up a static website with files stored in a Google Storage bucket. I already own a custom domain and have, at a minimum, some barebone files to see if the site is setup successfully.

Ideally, I'd like to serve the content via SSL when accessing that custom domain and have the content cached from Google Storage utilizing Google Cloud CDN so that end users are served content from the CDN as opposed to being served from Cloud Storage directly.

I haven't been able to find the perfect setup for this yet or even solidify if Google enables/supports this scenario at this point (I've read that there may be a need to leverage a load balancer to support SSL, but nothing conclusive).

So far I have created a Google Storage bucket and uploaded the desired files. I then made the bucket publicly readable to ensure there aren't any permissions issues. From there I set up a load balancer to leverage my custom domain with the checkbox of Google Cloud CDN checked, the storage bucket just created, set as the backend, and the host file mapping set to the default settings.

UPDATE: It turned out just a few more steps were required. First, I needed to turn "Requestor Pays" off for the Storage bucket being utilized. Secondly, I needed to add permissions of "Storage Object Viewer" for "allUsers" (the legacy permission won't work here). Lastly, I had to both set the "A" and "AAAA" records to the IPV4 and IPV6 addresses of my Load Balancer for the DNS config on my domain name (and clear all previous values so that they were only referring to the new ones). After all of this was completed, everything is working as it should be :)

Thanks to both Cloud Ace (for leading me in the right direction) and a Google Customer Engineer that I met last week (for referring me to this article for reference: https://medium.com/@marco_37432/create-a-custom-domain-cdn-with-google-beta-7ad9531dfbae)!

B. Blunt
  • 587
  • 1
  • 4
  • 9
  • Google search is your friend: https://cloud.google.com/storage/docs/hosting-static-website. Note CDN requires a load balancer. A load balancer provides you with an IP address, but this is not the same as a static web site hosted on Cloud Storage. Read the docs and decide which features you require (CDN or Static Website). For a CDN to support SSL/TLS you need an HTTPS front-end on your load balancer. – John Hanley May 16 '19 at 07:28
  • Hi John, yes I did do a Google search prior, which is the reason for my post (I found the same article before). I have updated my question to try and add more specificity. Thanks. – B. Blunt May 17 '19 at 05:16

1 Answers1

5

When you create HTTP(S) Load Balancer, there should be a Certificate section in Frontend configuration if you set the protocol to HTTPS, also preserve a static IP. Then you can configure the DNS to point the domain to this IP.

  • If the custom domain name is registered with Google as well, is additional configuration required to get it to function properly with the newly setup Load Balancer or is this something Google Cloud takes care of for me, on the backend? – B. Blunt May 17 '19 at 05:18
  • No extra actions required – Cloud Ace Wenyuan Jiang May 17 '19 at 05:21
  • I also suggest to check the bucket permission. You can use the "acl" command to set bucket permission[1] or via Google Console[2]. [1]: https://cloud.google.com/storage/docs/gsutil/commands/acl#ch-examples [2]: https://cloud.google.com/storage/docs/cloud-console#_bucketpermission – Lozano May 20 '19 at 10:19
  • Thanks @CloudAce! I've updated the question with my findings, but your answer definitely led me in the right direction! – B. Blunt May 27 '19 at 04:10