Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run vs Cloud Run Functions

I'm building an API and I need help understanding whether I need Cloud Run, or Cloud Run Functions. I guess they're not the same service...?

Right now, I created a Node.js project, and ran:

 

gcloud run deploy my-function \                                         
  --source . \                                                           
  --allow-unauthenticated \          
  --region us-central1

 

 

But I'm not sure what it creates... a Cloud Run function, or a Cloud Run Function function (?).
I'm really confused, so I'd appreciate any help!

Solved Solved
0 2 2,094
1 ACCEPTED SOLUTION

Hi @CastAsHuman,

Welcome to the Google Cloud community!

You're absolutely right that Cloud Run and Cloud Run Functions are not the same service. I'll help clarify the difference and explain what you've created based on your deployment command.

Cloud Run vs Cloud Run Functions

  • Cloud Run:
    • Cloud Run is a fully managed compute platform that runs stateless containers. It allows you to deploy and run any containerized application, including Node.js, Go, Python, etc. It's perfect for microservices, APIs, and backend services that run in containers.
  • Cloud Run Functions:
    • Cloud Run Functions is a specialized version of Cloud Run, designed to run serverless functions directly from source code (without the need to containerize the app yourself). It’s tightly integrated with Google Cloud Functions. They’re best suited to execute single-purpose functions for your application that respond to HTTP calls or events.

The command you deploy is a Cloud Run service (not Cloud Run Functions) using your Node.js code. The --source . points to the directory of your Node.js project, meaning you're deploying from source code (which is typical for Cloud Run). The gcloud run deploy command you're running deploys a Cloud Run service, which means it's deploying a containerized app (or code that will be containerized automatically). It's not deploying a Cloud Run Function.

To summarize, if you're looking to deploy simple functions without worrying about containers, you should consider Cloud Run Functions. If you want to deploy full containerized apps (with more control over the runtime environment), use Cloud Run.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

View solution in original post

2 REPLIES 2

Hi @CastAsHuman,

Welcome to the Google Cloud community!

You're absolutely right that Cloud Run and Cloud Run Functions are not the same service. I'll help clarify the difference and explain what you've created based on your deployment command.

Cloud Run vs Cloud Run Functions

  • Cloud Run:
    • Cloud Run is a fully managed compute platform that runs stateless containers. It allows you to deploy and run any containerized application, including Node.js, Go, Python, etc. It's perfect for microservices, APIs, and backend services that run in containers.
  • Cloud Run Functions:
    • Cloud Run Functions is a specialized version of Cloud Run, designed to run serverless functions directly from source code (without the need to containerize the app yourself). It’s tightly integrated with Google Cloud Functions. They’re best suited to execute single-purpose functions for your application that respond to HTTP calls or events.

The command you deploy is a Cloud Run service (not Cloud Run Functions) using your Node.js code. The --source . points to the directory of your Node.js project, meaning you're deploying from source code (which is typical for Cloud Run). The gcloud run deploy command you're running deploys a Cloud Run service, which means it's deploying a containerized app (or code that will be containerized automatically). It's not deploying a Cloud Run Function.

To summarize, if you're looking to deploy simple functions without worrying about containers, you should consider Cloud Run Functions. If you want to deploy full containerized apps (with more control over the runtime environment), use Cloud Run.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Hi! Yes, they aren't the same service. They have a slightly different abstraction level. 

Cloud Run - A service that operates with images to deploy the applications
Cloud Run Functions - Has a higher abstraction level and we deploy to Cloud Run Functions with the actual code. 

In your command, you call gcloud run (Cloud Run), but apparently you should use gcloud function (Cloud Run Functions) because you specify your current folder as a source. 

Here's the guide how to do it:
https://cloud.google.com/functions/docs/deploy