Serving images directly from GCS to GAE using the Blobstore APIs and images

Many questions and answers on Blobstore and Google Cloud Storage (GCS) are two or three years old, while in those years the situation has changed dramatically. GCS is no longer a standalone service. Now integrated with Google App Engine (GAE).

Google seems to be pushing GCS so hard that Blobstore is out of date , for example,

The file API feature used here to write files to Blobstore has been deprecated and will be removed in the future, in support of writing files to Google Cloud Storage and using Blobstore to serve them.

I think the time has come to switch to GCS.

For example, www.example.com- this is a site built on GAE, and example.jpg- this is an image stored in GCS, I want to serve the image using the URLhttp://www.example.com/images/example.jpg

This was not possible, but now it is possible thanks to integration .

I found this:

https://developers.google.com/appengine/docs/python/googlecloudstorageclient/ says:

When the Blobstore API is used in conjunction with the Image API, you get a powerful way to serve the images, since you can directly serve images from the GCS, bypassing the App Engine application, which saves on instance cost per hour.

I know how to "bypass the App Engine application . " Is there any example of how to get around GAE while serving images using the Blobstore and image APIs?

+4
3

: https://developers.google.com/appengine/docs/python/images/functions#Image_get_serving_url

, Google.

-, blobstore API create_gs_key() blob GCS. blob get_serving_url() Image API.

API- URL-, .

+3

"www" , WWW GAE Cname, , . cdn.example.com, , http://cdn.example.com/images/example.jpg

.

GCS cdn.example.com / .

404 , .

https://cloud.google.com/storage/docs/website-configuration?hl=en

0

In fact, you don’t need to use BlobStore at all. The following will work to get the URL of the image API for serving images stored in GCS:

from google.appengine.api import images

images.get_serving_url(None, filename='/gs/<bucket>/<object>'))
0
source

All Articles