google-app-enginegoogle-cloud-platformcloudgoogle-cloud-load-balancergoogle-cloud-cdn

Why do I need to enable LoadBalancer to enable Cloud CDN for App Engine in GCP?


I am currently using App Engine in gcp,I want is use cloud CDN for my application. In the google cloud docs it is mentioned that i need to enable load balancer to use Cloud CDN for App Engine. Why should I enable load balancer when I am using app engine which is serverless. can someone explain.


Solution

  • The other answers/comments are good, but you're asking 'why' so I'm going to try to answer that.

    So why do you need to do this?

    Because you need to tell GCP how to route traffic between your GCP services and in GCP that configuration lives in Google Cloud Load Balancer.

    You were correct that many of GCP's services like App Engine come with a load balancer, think of it as a simplified version of Google Cloud Load Balancer. It comes configured with a bunch of reasonable default settings and lets you get up and running without needing to think about it. There are some basic settings you can set from within App Engine's settings / yaml files, but anything beyond that then you need to go through the process of setting up Google Cloud Load Balancer yourself. It seems that Cloud CDN doesn't come with a default load balancer.

    I believe that when you setup Google Cloud Load Balancer for App Engine, that it takes the place of App Engine's default load balancer. I had to setup Google Cloud Load Balancer for my App Engine service and I didn't notice a slow down. But also, I don't think you necessarily need to have your App Engine traffic route through Google Cloud Load Balancer, as long as Cloud CDN is on a different subdomain.

    I do believe that John Hanley was correct about Cloud CDN probably being overkill. You can serve static assets directly out of a Google Cloud Storage bucket or by specifying a static_files entry in your app.yaml. Both of those options are simpler and work well.