How to use Google Cloud CDN to access Google Cloud Storage public objects

守給你的承諾、 提交于 2019-12-12 12:02:46

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/42691577/how-to-use-google-cloud-cdn-to-access-google-cloud-storage-public-objects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!