If you are creating a new function, see the Console Quickstart on Cloud Run. The content on this page only applies to existing legacy functions created with the Cloud Functions v1 API.
Stay organized with collections
Save and categorize content based on your preferences.
The Ruby Runtime
Overview
Your Cloud Run function runs in an environment consisting of an operating
system version plus add-on packages, language support, and
the Functions Framework library that supports and invokes your function.
This environment is identified by the language version, and is known as the
runtime.
Cloud Run functions supports several versions of Ruby, listed on the
Runtime support page. You can
select the preferred Ruby runtime for your function during deployment.
gcloud
If you're using the Google Cloud CLI, specify the runtime
by using the --runtime parameter. NAME specifies the
function name. For example:
For Cloud Run functions to find your function's definition, your
source code must follow a specific structure. See
Writing Cloud Run functions
for more information.
Function preparation
You can prepare a function directly from the Google Cloud console or write it on
your local machine and upload it. To prepare your local machine for Ruby
development, see Setting up a Ruby development environment.
The library that invokes your function is the
Ruby Functions Framework.
Specifying dependencies
You can specify dependencies for your function by adding them to a project file.
For more information, see Specifying dependencies in
Ruby.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eCloud Run functions utilize a runtime environment that includes the operating system, language support, and the Functions Framework library, with the specific environment determined by the selected Ruby version.\u003c/p\u003e\n"],["\u003cp\u003eYou can choose from several supported Ruby runtimes when deploying your Cloud Run function, with the available versions listed on the Runtime support page.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the Google Cloud CLI, the \u003ccode\u003e--runtime\u003c/code\u003e parameter allows you to specify the desired Ruby runtime for your function during deployment.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run functions require a specific source code structure for the system to locate your function's definition; therefore, it's imperative to follow the guidance given in the Writing Cloud Run functions documentation.\u003c/p\u003e\n"],["\u003cp\u003eRuby supports only CloudEvent functions as event-driven function types, and you can manage dependencies for your function by adding them to a designated project file, as detailed in the Specifying dependencies in Ruby guide.\u003c/p\u003e\n"]]],[],null,["# The Ruby Runtime\n================\n\nOverview\n--------\n\nYour Cloud Run function runs in an environment consisting of an operating\nsystem version plus add-on packages, language support, and\nthe Functions Framework library that supports and invokes your function.\nThis environment is identified by the language version, and is known as the\nruntime.\n\nFor information about runtimes in general, and to learn which Ubuntu version\neach Ruby runtime uses, see the [Cloud Run functions execution\nenvironment](/functions/1stgendocs/concepts/execution-environment#ruby).\n\nSelect your runtime\n-------------------\n\nCloud Run functions supports several versions of Ruby, listed on the\n[Runtime support](/functions/1stgendocs/runtime-support#ruby) page. You can\nselect the preferred Ruby runtime for your function during deployment. \n\n### gcloud\n\nIf you're using the Google Cloud CLI, specify the runtime\nby using the `--runtime` parameter. \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e specifies the\nfunction name. For example: \n\n```bash\ngcloud functions deploy NAME --no-gen2 --runtime ruby33 --trigger-http\n```\n\nFor more deployment parameters, see [Deploy a Cloud Run function](/functions/1stgendocs/deploy#basics).\n\n### Console\n\nIf you're using the Google Cloud console, see the [Google Cloud console\nquickstart](/functions/1stgendocs/console-quickstart-1st-gen) for detailed instructions.\n\nSource code structure\n---------------------\n\nFor Cloud Run functions to find your function's definition, your\nsource code must follow a specific structure. See\n[Writing Cloud Run functions](/functions/1stgendocs/writing#structuring_source_code)\nfor more information.\n\nFunction preparation\n--------------------\n\nYou can prepare a function directly from the Google Cloud console or write it on\nyour local machine and upload it. To prepare your local machine for Ruby\ndevelopment, see [Setting up a Ruby development environment](/ruby/docs/setup).\nThe library that invokes your function is the\n[Ruby Functions Framework](/functions/1stgendocs/functions-framework).\n| **Note:** The only type of [event-driven functions](/functions/1stgendocs/writing#types_of_cloud_functions) Ruby supports are [CloudEvent functions](/functions/1stgendocs/writing#cloudevent_functions).\n\nSpecifying dependencies\n-----------------------\n\nYou can specify dependencies for your function by adding them to a project file.\nFor more information, see [Specifying dependencies in\nRuby](/functions/1stgendocs/writing/specifying-dependencies-ruby).\n\nWhat's next\n-----------\n\n- [Create your first Ruby function](/functions/1stgendocs/create-deploy-http-ruby-1st-gen) from scratch."]]