4

I have some public binary files that are served from Google Cloud Storage(GCS) and would like to explore usage of Google Cloud CDN for lower latencies. I am using GCS caching by setting appropriate HTTP headers when creating GCS objects.

Is it possible to use Google Cloud CDN to serve these objects from GCS? If not, does Google Cloud CDN only works with HTTP(S) load-balancers?

Sunil Kumar
  • 1,631
  • 2
  • 19
  • 33

2 Answers2

3

Google Cloud Storage does provide an amount of edge caching by default, and so I advise you to experimentally measure whether your performance is already good enough to need a CDN.

That said, Google Cloud CDN and Cloud Load Balancer support GCS buckets as a backing resource, although the feature is in beta. The complete instructions are here: https://cloud.google.com/compute/docs/load-balancing/http/using-http-lb-with-cloud-storage

To set things up, configure a Google Cloud Load Balancer like usual, but as your backing bucket, specify a GCS bucket, and specify that Cloud CDN should be used, like so:

gcloud beta compute backend-buckets create static-bucket \
    --description "A Bucket" \
    --gcs-bucket-name [EXAMPLE_BUCKET] \
    --enable-cdn
Brandon Yarbrough
  • 37,021
  • 23
  • 116
  • 145
  • 1
    Has anyone gotten the load balancer URLs to return a bucket object for an anonymous user? I can't figure out how to get the LB to work, see my question: https://stackoverflow.com/questions/45289674/public-object-in-cloud-storage-bucket-isnt-accessible-through-load-balancer – androidguy Jul 24 '17 at 20:58
1

As far as I know, Google Cloud Storage comes with some sort of edge caching.

Yes, you need to have a LB. It's in beta, read the documentation here.

This is probably intended to serve static files and dynamic backend from the same domain, not to add CDN to GCS.

Tatsuyuki Ishi
  • 3,883
  • 3
  • 29
  • 41