4
votes

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?

2

2 Answers

3
votes

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
1
votes

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.