Search code examples
google-apicompressiongoogle-cloud-cdn

how to enable google cdn dynamic compression?


Google's documentation mentions that cdn can enable dynamic compression, and an example is provided below, but I can't successfully set the dynamic compression strategy

document

document link

The error I see when I execute the command is as follows, is it changed to other flags?And from the log, the size of the transferred image is not compressed.

error


Solution

  • It looks like there are two problems. First, you appear to have an old version of gcloud that was released prior to the dynamic compression Beta. The right way to upgrade gcloud will depend on your platform, but it's typically gcloud components update or sudo apt-get upgrade google-cloud-sdk.

    Once you have an up-to-date gcloud installation, you'll likely run into the second problem. Google's documentation incorrectly advises you to use gcloud compute, but you need to use gcloud beta compute while the feature remains in Beta:

    $ gcloud compute backend-services update YOUR_BACKEND_SERVICE_NAME --compression-mode=AUTOMATIC ERROR: (gcloud.compute.backend-services.update) unrecognized arguments:
    
     --compression-mode flag is available in one or more alternate release tracks. Try:
    
      gcloud alpha compute backend-services update --compression-mode
      gcloud beta compute backend-services update --compression-mode
    
      --compression-mode=AUTOMATIC (did you mean '--custom-response-header'?)
      To search the help text of gcloud commands, run:
      gcloud help -- SEARCH_TERMS
    $