An organization has a Cloud Run service named `invoice-service` deployed in the `us-central1` region. You need to configure this Cloud Run service so that all outbound network traffic from the instances is routed through an existing Serverless VPC Access connector named `vpc-conn`. Which `gcloud` command should you run to accomplish this task?
- gcloud run services update invoice-service --vpc-connector=vpc-conn --vpc-egress=all-traffic --region=us-central1Answer
- Bgcloud run services update-traffic invoice-service --vpc-connector=vpc-conn --region=us-central1
- Cgcloud functions deploy invoice-service --vpc-connector=vpc-conn --region=us-central1
- Dgcloud projects add-iam-policy-binding project-id --member=serviceAccount:[email protected] --role=roles/owner
Answer
Execute the command `gcloud run services update invoice-service --vpc-connector=vpc-conn --vpc-egress=all-traffic --region=us-central1` to attach the Serverless VPC Access connector and route all outbound traffic through it.
To route all outbound traffic from an existing Cloud Run service through a Serverless VPC Access connector, you update the service configuration using `gcloud run services update` with `--vpc-connector` to set the connector name and `--vpc-egress=all-traffic` to specify that all egress traffic must pass through the VPC.
Step-by-Step Solution
Key Concept
Cloud Run Outbound Networking and Serverless VPC Access Connector Management