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
I wanted to do this too. But there is currently no way of binding Google Cloud Storage buckets directly to a top-level domain name, as you found out.
The IP addresses where Google Cloud Storage answers web requests change often (to adapt to changing conditions on the Internet), so Google doesn't want to you add a subset of those (which would quickly get out of date) as A records for the DNS server of your website. Google instead requires a CNAME to a DNS name it controls, so it can change the IP addresses for Google Cloud Storage as often as it needs to. And a CNAME can only be added to a subdomain and not a top-level domain. (This is because when there is a CNAME at a given level, the DNS server for that domain will not answer any other queries for that level. But a top-level domain needs to answer also at least NS and SOA queries.)
The only workaround for this right now is, as described in another answer, to set up the CNAME for the www subdomain, and configure your DNS hosting service to do a http-level redirect from the top-level domain to the www subdomain. (Mosty providers will support that.)
If you're not a fan of this solution (like me), there are exactly three possibilities. The first one is to wait for Google to offer the possibility to host top-level domains on Google Cloud Storage. That requires Google to DNS hosting, first though. Enabling top-level domain support would require extra work on Google's part (after building their DNS hosting offering), but it's only possible if Google controls both parts. I have no clue if or when Google will ever offer that, though. But one can hope.
The second solution is to switch to another big provider. Amazon can host static websites from S3 on a top-level domain. But that's because they also host DNS for that domain. There may be others. All large cloud providers will serve data from a set of frequently-changing IP addresses. So if they don't host your DNS too, they will need you to set a CNAME on a subdomain.
The third (theoretical, at least) solution is to switch to a smaller cloud provider, offering equivalent service, maybe on OpenStack, etc. Because they're smaller, their IP routing setup will be quite a bit simpler than the big players (Amazon, Google, etc.) and they would then be able to give you a small set of IP addresses to set as A records on your top-level domain. This is just an educated guess on my part, though. I don't know right now of any such smaller cloud storage providers.
(Well, okay, the fourth possibility is to give up on the idea of hosting your website statically. But personally, I really like this option when possible, at least from a security and responsiveness point of view.)