Question

Difficulty: MediumManaging Cloud Run Resources

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?

  1. gcloud run services update payment-gateway --ingress=internal-and-cloud-load-balancing --region=us-central1Answer
  2. B
    gcloud run services update-traffic payment-gateway --ingress=internal-and-cloud-load-balancing --region=us-central1
  3. C
    gcloud functions deploy payment-gateway --ingress-settings=internal-only --region=us-central1
  4. D
    gcloud 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

1
Identify the required operational management tool and subcommand for Cloud Run configuration changes.
The target command for updating service configuration on an existing Cloud Run deployment is `gcloud run services update`.
Service settings such as ingress, environment variables, scaling limits, and memory allocation are updated via service configuration update flags.
2
Select the correct ingress flag value for VPC and Load Balancer traffic.
Set `--ingress=internal-and-cloud-load-balancing`.
This specific flag value restricts inbound traffic to internal VPC sources, VPC Service Controls boundaries, and Cloud Load Balancing endpoints, blocking public direct requests.

Key Concept

Cloud Run Ingress Control Management
Rate this question