There's more...

In this recipe, we have seen how to host a website without a domain name. The preceding example works best with a domain you manage or own. To make it work with your domain name, you'll have to take the following steps:

  1. Name the bucket with the domain name, for example: gs://www.example.com.
  2. Create a CNAME record pointing to c.storage.googleapis.com.
  3. Set a website configuration for the bucket, to make it behave like a static website:
gsutil web set -m index.html -e 404.html gs://www.example.com

Get Google Cloud Platform Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.