Reputation: 21
What is the difference between 'backend-services update' and 'backend-services update-backend'
gcloud compute backend-services update ..
gcloud compute backend-services update-backend ..
Consider I have a backend-service mapped to two NEGs from different regions. Will I be able to divert traffic to only one NEG just by updating the region for the backend-service using something like gcloud compute backend-services update --region=REGION-OF-NEG1
?
Upvotes: 0
Views: 1075
Reputation: 495
‘gcloud compute backend-services update’ is used to update backend services.
‘gcloud compute backend-services update-backend’ updates a backend that is part of a backend service. This is useful for changing the way a backend behaves. Example changes that can be made include changing the load balancing policy and draining a backend by setting it’s capacity scaler to zero. It updates the attributes of a backend that is already associated with a backend service. Configurable attributes depend on the load balancing scheme and the type of backend (instance group, zonal NEG, serverless NEG, or internet NEG).
The command ‘gcloud compute backend-services update --region=REGION-OF-NEG1’ will only update the region of that respective NEG but it won’t divert traffic to particular NEG.
If you want to redirect the traffic to a specific backend service, you can use host and path rules. Host and path rules determine how your traffic will be directed. Also, forwarding rules route traffic by IP address, port, and protocol to a load balancing configuration consisting of a target proxy, URL map, and one or more backend services.
You can check how the traffic is managed here.
Upvotes: 0