An internal microservice hosted on Cloud Run named `payment-gateway` in the `us-central1` region must be configured so that it only accepts traffic originating from resources within the same Virtual Private Cloud (VPC) network or through a Google Cloud Cloud Load Balancing instance, while blocking direct public internet requests. Which command should a Cloud Engineer execute to apply this networking restriction to the existing service?
- gcloud run services update payment-gateway --ingress=internal-and-cloud-load-balancing --region=us-central1Answer
- Bgcloud run services update-traffic payment-gateway --ingress=internal-and-cloud-load-balancing --region=us-central1
- Cgcloud functions deploy payment-gateway --ingress-settings=internal-only --region=us-central1
- Dgcloud projects add-iam-policy-binding my-project --role=roles/viewer --member=allUsers
Answer
Execute `gcloud run services update payment-gateway --ingress=internal-and-cloud-load-balancing --region=us-central1` to restrict network access.
The correct command uses `gcloud run services update` along with the `--ingress=internal-and-cloud-load-balancing` flag and the appropriate region flag. This updates the Cloud Run service configuration to allow traffic only from internal VPC networks and Google Cloud Load Balancers while blocking direct public requests.
Step-by-Step Solution
Key Concept
Cloud Run Ingress Control Management