Runtimes and runtime templates
This page describes runtimes and runtime templates for Colab Enterprise.
A runtime is a Google-provisioned virtual machine (VM) that can run the code in your notebook (IPYNB file).
A runtime template is a VM configuration that specifies a machine type and other characteristics of the VM, as well as common settings such as the network and whether public internet access is enabled. When you create a runtime, its VM is created according to the specifications of a runtime template.
Workflow
You can create a Colab Enterprise notebook and run code in it without needing to understand runtimes. When you run your code for the first time, Colab Enterprise provisions a default runtime and runs your code on it. Colab Enterprise continues to use the default runtime until you connect to a different runtime.
To configure a runtime for specific needs, you must:
Create a runtime template with the configuration that you need.
Create a runtime based on that template.
Connect to the runtime from your notebook and run your code.
Runtimes
This section describes the characteristics of runtimes.
Default runtime
If you don't create a runtime, a runtime is created for you the first time that you run code or connect to the default runtime.
When Colab Enterprise creates your default runtime, it also creates a default runtime template. Both the runtime and runtime template appear in the Google Cloud console, where you can get information about them.
There is one default runtime and one default runtime template per project, per region.
Default runtime specifications
The default runtime includes the following specifications:
- Machine type:
e2-standard-4
- Accelerators: None
- Idle shutdown (Experimental): Enabled
- Network: Your project's default Virtual Private Cloud network
- Public internet access: Enabled
- End user credential authentication: Enabled
- Auto deletion: Automatic deletion 18 hours after creation
Runtimes are regional
Runtimes are regional, and must be located in the same region as your notebook.
Runtimes are exclusive to a user
Runtimes are exclusive to a user. You can't share your runtimes with others and you can't use their runtimes. Even if you share a notebook with someone, they don't have access to your runtime and must run the notebook on their own runtime.
However, users can create their own runtimes based on the same runtime template. See Runtime templates can be shared with users.
Runtimes can be shared by notebooks
You can connect more than one notebook to the same runtime but this isn't recommended. Multiple notebooks sharing the same runtime can cause problems, including:
The notebooks may run slowly because they are sharing the runtime's compute resources.
The code in one notebook can affect the state of the runtime's VM for the other notebook. For example, if you install version 1.3 of a package in one notebook, but your other notebook requires version 1.2, you might have a version incompatibility when you run the second notebook.
Instead of running code from multiple notebooks on the same runtime, you can create a runtime for each notebook based on the same runtime template. See You can create multiple runtimes from the same runtime template.
Runtime charges
You are charged for runtime processing based on the machine type and accelerators that you use. See Colab Enterprise pricing.
You can create multiple runtimes from the same runtime template
You can create multiple runtimes from a single non-default runtime template. This way, you can run multiple notebooks on VMs with the same configuration without sharing the resources of that VM.
Runtime templates
This section describes the characteristics of runtime templates.
Runtime templates are regional
Runtime templates are regional. When you create a runtime, it is in the same region as the runtime template, and the runtime can only be used with notebooks in that region.
Runtime templates can be shared with users
You can share a runtime template with other users. This way, each user can create their own runtime based on the same runtime template, and therefore multiple users can run the same notebook on the same VM configuration.
To learn more, see Manage access to a runtime template.
Configuration
Runtime templates determine the configuration of your runtime's VM. You can specify any of the following:
Region
Choose the region where your notebook is. Runtimes created from runtime templates are in the same region as the runtime template. For the notebook to run code in the runtime, the notebook and runtime must be in the same region.
Machine type, disk type, and disk size
For information on machine types, see the Machine families resource and comparison guide.
Accelerators
You can add accelerators to your runtime template configuration. Accelerator availability is based on the machine type and region.
Network
Specify your network or use the project's default Virtual Private Cloud network.
Idle shutdown
Colab Enterprise enables idle shutdown by default. This setting shuts down your instance after 180 minutes of inactivity. You can change the number of minutes of inactivity before shutdown, or you can disable idle shutdown.
Public internet access
To get more control over the security of your notebook and other resources, you can turn off public internet access. If you configure your runtime template this way, notebooks that use runtimes created from the runtime template will not have access to the public internet.
End-user credential authentication
By default runtime templates use end-user credential authentication to give your notebook access to Application Default Credentials (ADC). You can use this access to ADC to run code in your notebook that interacts with Vertex AI and other Google Cloud services. When end-user credentials are enabled, your notebook uses the credentials of whoever runs the notebook to determine access to Google Cloud resources.
If end-user credentials aren't enabled, you can get access to ADC by authenticating the user through your notebook's code. To learn more, see the "User credentials" section of How to provide credentials to ADC.
Runtime templates are not editable
After you create a runtime template, you can't change it. To use a runtime template with a different configuration, you must create a new runtime template.
Runtime template charges
There are no charges for creating or storing runtime templates. See also Runtime charges.
What's next
- Create a runtime based on a runtime template.
- Connect to a runtime.
- Create a runtime template.