Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

Deploy a Node.js API on Cloud Run: Production Setup Guide

A practical Cloud Run deployment guide for Node.js APIs, covering port binding, deployment paths, service identity, secrets, health checks, concurrency, and warm-instance trade-offs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To build and deploy a production-ready Node.js API on Cloud Run, make the server listen on Cloud Run’s injected PORT, deploy it from source or a controlled container image, and configure identity, secrets, health checks, concurrency, and scaling for the workload. A successful deployment is only the start: verify the new revision is healthy and receiving the intended traffic before considering the release complete.

Prepare the project and deployment environment

Before deploying, select or create a Google Cloud project, install or update the Google Cloud CLI, authenticate, choose a region, and enable the APIs required by the deployment path. The official Google Cloud Node.js quickstart describes the source-deployment prerequisites and permissions; exact IAM requirements vary with the path you choose and your organization’s policies. In particular, the build service account needs the Cloud Run Builder role for the documented source-build path.

As an Amazon Associate I earn from qualifying purchases.

Choose a region with your users’ request latency and the location of dependent Google Cloud resources in mind. Also verify that the services your API depends on are available in that region. Region choice is separate from controls such as CPU, memory, request timeout, and instance limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make the Node.js server listen on Cloud Run’s port

Cloud Run supplies the listening port through the PORT environment variable. Your server must bind to that value rather than relying on a hard-coded local-development port. The following is the minimal pattern used in Google’s Node.js quickstart; it assumes app has already been created:

const port = parseInt(process.env.PORT) || 8080;
app.listen(port, () => {
  console.log(`Listening on port ${port}`);
});

The fallback is useful when running locally, but this snippet only addresses port binding. It does not establish that the API has been load-tested, secured, or configured for production.

Choose a deployment path

Path Build and image control Fits best when
Deploy from source Cloud Run builds a container image from the project source; source deployment can use a Dockerfile automatically. You want Cloud Run to automate the build steps and the project is ready to build from its source directory.
Deploy a container image Your team builds and pushes an image to Artifact Registry, then deploys that image to Cloud Run. You need explicit control over the image and want it to fit an established image-release process.

Deploy from source

From the project directory, run:

gcloud run deploy --source .

The command may prompt for a service name, region, required APIs, and whether to allow public access. Choose public access only when the API is intended to be reachable without Cloud Run authentication. For a private service, configure authentication and test it using Google’s private-service flow rather than assuming a successful deployment is publicly accessible.

Deploy a container image

For an image-based release, build and push the image to Artifact Registry, then deploy that image to Cloud Run. This separates image creation from service deployment and gives the team control over the artifact being released; it is not the same workflow as having Cloud Run build from source.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure identity and protect secrets

Give the service a least-privilege identity

Use a dedicated service account for the Cloud Run service and grant it only the permissions the API needs to call Google Cloud services. Deployment permissions and the runtime service identity serve different purposes: a person or deployment system needs permission to create or update a service, while the service account needs permission to access runtime resources.

Store sensitive values in Secret Manager

Keep API keys, passwords, certificates, and similar values in Secret Manager, not in source control or build-time environment values. Grant the Cloud Run service identity the Secret Manager Secret Accessor role on the specific secret it needs.

Delivery method When an updated secret becomes visible Operational consideration
Secret volume mount The mounted value is fetched when read, which can support rotation. Have the application read the mounted secret as needed if it must observe an updated value.
Environment-variable secret The secret is resolved when an instance starts. Google recommends pinning this method to a specific secret version rather than latest; a changed value is not automatically injected into an already-running instance.

These delivery methods have different update behavior. Choose based on how the application consumes the value and how you intend to roll out secret changes.

Use health checks to control startup and traffic

Configure health checks so Cloud Run can determine whether the container has started and is ready to serve requests. For an HTTP probe, implement an HTTP/1 endpoint at the path configured for the probe. A successful startup probe indicates that the container is ready to receive traffic. If the default startup health check fails during deployment, the revision is marked unhealthy and traffic is not routed to it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cloud Run’s health-check documentation distinguishes startup, liveness, and readiness behavior. Its configuration reference labels readiness probes as Preview; confirm current availability and status before relying on them. Do not treat readiness-probe support as generally available based on this guide alone.

Each configuration change creates a new immutable revision. After deployment, check the new revision’s health and confirm that traffic is going to the intended revision before treating the release as complete.

Set concurrency for the API, not by habit

Cloud Run can send concurrent requests to one instance up to its configured maximum. Google Cloud’s current documentation, accessed in 2026, sets the maximum at 1,000 concurrent requests per instance. The default depends on how a new service is deployed: the CLI and Terraform default is 80 times the number of vCPUs, while the console default is 80. These are platform defaults, not recommended values for every API.

Google’s documentation says, “Node.js is inherently single-threaded.” Asynchronous I/O can still let a Node.js server handle multiple requests concurrently, but CPU-bound handlers can compete for execution time, and shared mutable state can create correctness problems. Validate how the application behaves under parallel requests before increasing concurrency.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Higher concurrency: can let fewer instances serve the same request volume and may reduce cost when the application handles parallel work efficiently.
  • Lower concurrency: can give requests more isolation or help services scale more responsively, but creates more instances for the same load.
  • Concurrency of one: may limit the service’s ability to scale efficiently during request spikes.

Load-test representative traffic, then monitor CPU, memory, latency, errors, and instance counts before changing the limit. A setting that works for mostly asynchronous I/O may be unsuitable for CPU-intensive handlers or code that is not safe under concurrent access.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Balance warm capacity, latency, and cost

Cloud Run scales instances in response to incoming requests. A minimum-instance setting keeps a configured floor of instances warm and can reduce latency associated with starting from zero. That benefit has a cost: warm instances incur billing charges, so estimate the impact using current pricing and realistic workload assumptions rather than assuming a universal monthly amount.

Google describes minimum instances as a best-effort target, not a guarantee. Capacity constraints, rebalancing, crashes, quota limits, or billing issues can leave fewer healthy instances than the configured floor. Google’s current minimum-instances guidance suggests considering at least three for high availability, but that figure is guidance—not an uptime promise or a substitute for designing and testing the whole service for failure.

Configuration Latency and capacity trade-off Cost and resilience trade-off
Zero minimum instances Allows scaling to zero; requests after an idle period may encounter scale-from-zero delay. Avoids paying to keep a minimum number of instances warm, but provides no warm-capacity floor.
Warm minimum instances Can reduce scale-from-zero delay by keeping a configured floor warm. Adds billing cost and remains a best-effort target rather than guaranteed capacity.

Request timeout, CPU, memory, maximum instances, and minimum instances are separate controls. Set each according to observed workload needs, and calculate cost from current Cloud Run pricing and your expected request volume, resource allocation, and warm-capacity choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Harden and verify the release

For container deployments, Google recommends switching to a non-root user when possible. Check the application’s file-access and runtime requirements before making that change. Cloud Run also has execution constraints, including failure of setuid binaries, so verify compatibility if the application or one of its dependencies relies on them.

  • Confirm the server binds to PORT and that the configured health-check endpoint returns successfully.
  • Verify that the service uses the intended service account and that it can access only the required secrets and Google Cloud resources.
  • Check whether the service should allow public access or require authentication, then test the chosen access path.
  • Inspect the newly created revision’s health and traffic allocation after deployment.
  • Review representative-load metrics before tuning concurrency or instance limits.
  • Estimate the billing effect of warm instances and other resource settings using current pricing.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.