Question

Difficulty: MediumManaging Cloud Run Resources

A cloud administrator manages an existing production Cloud Run service named `reporting-service` in the `us-central1` region. To mitigate cold start latency during morning traffic spikes while ensuring monthly compute costs do not exceed budget, the administrator needs to keep at least 5 warm instances idle and cap maximum scaling at 50 instances. Which `gcloud` command should the administrator execute to update these operational parameters?

  1. gcloud run services update reporting-service --min-instances 5 --max-instances 50 --region us-central1Answer
  2. B
    gcloud functions deploy reporting-service --min-instances 5 --max-instances 50 --region us-central1
  3. C
    gcloud run services update-traffic reporting-service --to-revisions LATEST=50 --region us-central1
  4. D
    gcloud projects add-iam-policy-binding my-project --member=serviceAccount:[email protected] --role=roles/editor

Answer

Execute the `gcloud run services update` command specifying the service name, `--min-instances 5`, `--max-instances 50`, and the deployment region.
The correct command uses `gcloud run services update` with `--min-instances 5` and `--max-instances 50`. This properly configures the scaling bounds of an existing Cloud Run service to keep 5 warm instances available while capping total instances at 50.

Step-by-Step Solution

1
Identify the target Cloud Run management CLI tool
Determine that operational parameter updates to existing Cloud Run services use `gcloud run services update`.
Cloud Run services require specific service-level commands to modify runtime flags such as instance limits.
2
Apply the requested minimum and maximum instance parameters
Append `--min-instances 5` to maintain warm instances and `--max-instances 50` to cap scale-out expansion.
Setting min-instances reduces cold starts while max-instances prevents unintended cost spikes.
3
Specify the regional scope
Include `--region us-central1` to target the specific regional service endpoint.
Cloud Run resources are regional resources and require regional context if not set in defaults.

Key Concept

Managing Cloud Run scaling parameters and instance limits via gcloud CLI
Rate this question