An organization is deploying an internal backend service packaged as a custom Docker container to Google Cloud Run. The service processes sensitive financial transactions and must only accept HTTP requests originating from resources within the same Virtual Private Cloud (VPC) network or VPC Service Controls perimeter. Additionally, unauthenticated public invocations must be prevented. Which `gcloud` command should the Cloud Engineer run to deploy this serverless application according to these security requirements?
- Run `gcloud run deploy financial-api --image=gcr.io/my-project/fin-api:v1 --ingress=internal --no-allow-unauthenticated` specifying the target region.Answer
- BRun `gcloud functions deploy financial-api --image=gcr.io/my-project/fin-api:v1 --ingress-settings=internal-only` specifying the target region.
- CRun `gcloud run deploy financial-api --image=gcr.io/my-project/fin-api:v1 --ingress=all --allow-unauthenticated` and assign the primitive `roles/editor` role to the default compute service account.
- DRun `gcloud run deploy financial-api --image=gcr.io/my-project/fin-api:v1 --port=8080` and disable the Cloud Run API in the target project.
Answer
Execute the `gcloud run deploy` command specifying `--ingress=internal` to block public traffic and `--no-allow-unauthenticated` to mandate IAM authentication.
Deploying a container image to Cloud Run with `--ingress=internal` restricts network traffic strictly to internal VPC resources and internal HTTP(S) load balancers. Adding `--no-allow-unauthenticated` ensures callers must present valid GCP identity tokens, fulfilling both network boundary and authentication security requirements.
Step-by-Step Solution
Key Concept
Cloud Run Ingress and Authentication Controls