Question

Difficulty: MediumManaging Cloud Run Resources

A site reliability engineer needs to optimize a latency-sensitive microservice running on Cloud Run named `telemetry-service` in the `europe-west1` region. To prevent cold starts during peak traffic hours, the service must maintain at least 5 warm container instances at all times, while restricting the upper autoscaling limit to 50 instances to maintain budget boundaries. Which `gcloud` command should be executed to apply these scaling configurations?

  1. Execute `gcloud run services update telemetry-service --region=europe-west1 --min-instances=5 --max-instances=50`.Answer
  2. B
    Execute `gcloud functions deploy telemetry-service --region=europe-west1 --min-instances=5 --max-instances=50`.
  3. C
    Execute `gcloud run services update-traffic telemetry-service --region=europe-west1 --to-revisions=MIN=5,MAX=50`.
  4. D
    Grant the service account running the workload the primitive `roles/editor` role at the project level to enable instance capacity management.

Answer

The command `gcloud run services update telemetry-service --region=europe-west1 --min-instances=5 --max-instances=50` properly configures autoscaling limits for Cloud Run.
Executing `gcloud run services update telemetry-service --region=europe-west1 --min-instances=5 --max-instances=50` correctly updates the active configuration of the existing Cloud Run service. Specifying `--min-instances=5` keeps 5 instances ready to process incoming requests without cold start latency, while `--max-instances=50` ensures that Cloud Run will not scale beyond 50 concurrent instances.

Step-by-Step Solution

1
Identify the target serverless platform and required operation
The target workload is deployed on Cloud Run, requiring resource autoscaling updates.
Cloud Run service operational configurations are managed via `gcloud run services update`.
2
Select the correct gcloud flags for minimum and maximum instance count limits
The `--min-instances` flag ensures minimum active instances to prevent cold starts, and `--max-instances` sets the scaling ceiling.
These flags directly modify the service template spec for instance limits.

Key Concept

Cloud Run Autoscaling and Instance Management
Rate this question