How to host an entire site on Google Cloud Storage?

Viewed 13769

Is there any way to host an entire site on Google Cloud Storage? That is, map a bucket directly to a top level domain.

E.g. create a bucket called mysite.com, then when the user visits mysite.com serve the content directly from cloud storage?

I see how to CNAME a subdomain, e.g. static.mysite.com, but can't figure out how to map the top-level domain to a bucket.

Any solution?

8 Answers

It's been a few years, but to anyone facing the same issue (mapping a "naked domain" to a GCS bucket), I see a couple of ways of achieving this.

One is to use any DNS provider that supports "CNAME flattening" (aka ALIAS, or ANAME records). Examples are: DNSimple, NS1, Dyn, DNS Made Easy, and Cloudflare.

Cloudflare is also one of the recommended ways of serving your bucket through HTTPS, and might also save you some money on your egress bill.

Another option, is to use this project to serve your files through App Engine. You get SSL for free, can use it on your "naked domain", and it allows you to configure redirects, rewrites, and custom headers.

You can't host your root domain from google cloud storage as of now, due to the cname restriction in DNS. You will have to have alias record in DNS pointing to an ipaddress to serve the root domain.

Firebase seems to be an alternate ideal option for this and is also almost free for standard traffic. Also has very few steps to host a static site - installing firebase cli with npm and a couple of commands to deploy. You can then get a list of ips from the firebase console that you can connect to your domain, by adding them in a alias record in your DNS.

https://firebase.google.com/docs/hosting

Related