Develop a service locally in Cloud Code for IntelliJ
Stay organized with collections
Save and categorize content based on your preferences.
With Cloud Code, you can develop your Cloud Run services
locally in a Cloud Run-like environment. Cloud Code watches
for changes in your source and quickly updates the running service to
reflect these changes.
Defining your run configuration
Before you run your service, you must create your run configuration:
Navigate to Run/Debug configurations selector in the Navigation bar and
click Edit Configurations.
Under Cloud Code: Cloud Run, choose Cloud Run: Run Locally.
If you want Cloud Code to redeploy your application
automatically after your changes are saved, under Watch mode - rebuild and
redeploy, select On file save. New Cloud Run services have On demand
selected by default. For more information about watch modes, see
Watch modes.
Specify your builder option and its relevant settings.
Cloud Code supports Docker, Jib, and Buildpacks
artifact types.
Click OK.
Optional: Customizing your configuration
When developing locally, you can specify additional settings like a service
account, environment variables, and SQL connections (when using
Cloud Run (fully managed)), using the Advanced revision settings section when
you choose Edit Configurations.
Environment variables
The following environment variables are automatically added to the
running containers:
Name
Description
Example
PORT
The port your HTTP server should listen on.
8080
K_SERVICE
The name of the Cloud Run service being run.
hello-world
K_REVISION
The name of the Cloud Run revision being run.
hello-world.1
K_CONFIGURATION
The name of the Cloud Run configuration that created the revision.
hello-world
Storing secrets
If your code includes potentially sensitive data like API keys, passwords, and
certificates, it is recommended you store them as secrets. With
Cloud Code, you can securely store these secrets in Secret Manager
and programmatically fetch them when you need them. For a detailed look at
how you can create and manage secrets with Cloud Code, refer to
the Secret Manager guide.
Running your service
To run your service, follow these steps:
Choose the Cloud Run: Run Locally run target from the Run/Debug
configurations selector in the Navigation bar.
Click Cloud Run: Run Locally.
View the logs from your running service, streamed directly to the output window.
Once deployment is complete, you can view your running service by following the
URL displayed in your Event Log panel. In the example below, this URL is
http://localhost:8080.
Get support
To submit feedback or report an issue in your IntelliJ IDE, go to
Tools > Cloud Code > Help / About > Submit
feedback or report an issue to report an issue on GitHub.
[[["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-28 UTC."],[[["\u003cp\u003eCloud Code enables local development of Cloud Run services in a simulated environment, with real-time updates reflecting code changes.\u003c/p\u003e\n"],["\u003cp\u003eBefore running a service, users must define a run configuration in the "Edit Configurations" section, specifying options like the builder type and watch mode preference.\u003c/p\u003e\n"],["\u003cp\u003eDuring local development, users can customize configurations by adding settings such as service accounts, environment variables, and SQL connections.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code automatically adds environment variables like PORT, K_SERVICE, K_REVISION, and K_CONFIGURATION to running containers.\u003c/p\u003e\n"],["\u003cp\u003eSecrets, such as API keys and passwords, can be securely stored in Secret Manager and accessed programmatically using Cloud Code.\u003c/p\u003e\n"]]],[],null,["# Develop a service locally in Cloud Code for IntelliJ\n\nWith Cloud Code, you can develop your Cloud Run services\nlocally in a Cloud Run-like environment. Cloud Code watches\nfor changes in your source and quickly updates the running service to\nreflect these changes.\n\nDefining your run configuration\n-------------------------------\n\nBefore you run your service, you must create your run configuration:\n\n1. Navigate to Run/Debug configurations selector in the Navigation bar and click **Edit Configurations**.\n2. Under Cloud Code: Cloud Run, choose **Cloud Run: Run Locally**.\n3. If you want Cloud Code to redeploy your application automatically after your changes are saved, under **Watch mode - rebuild and\n redeploy** , select **On file save** . New Cloud Run services have **On demand** selected by default. For more information about watch modes, see [Watch modes](/code/docs/intellij/watch-modes).\n4. Specify your builder option and its relevant settings.\n\n Cloud Code supports Docker, Jib, and Buildpacks\n [artifact types](https://skaffold.dev/docs/builders/).\n5. Click **OK**.\n\n### Optional: Customizing your configuration\n\nWhen developing locally, you can specify additional settings like a service\naccount, environment variables, and SQL connections (when using\nCloud Run (fully managed)), using the Advanced revision settings section when\nyou choose **Edit Configurations**.\n\n#### Environment variables\n\nThe following environment variables are automatically added to the\nrunning containers:\n\nStoring secrets\n---------------\n\nIf your code includes potentially sensitive data like API keys, passwords, and\ncertificates, it is recommended you store them as secrets. With\nCloud Code, you can securely store these secrets in Secret Manager\nand programmatically fetch them when you need them. For a detailed look at\nhow you can create and manage secrets with Cloud Code, refer to\nthe [Secret Manager guide](/code/docs/intellij/secret-manager).\n\nRunning your service\n--------------------\n\nTo run your service, follow these steps:\n\n1. Choose the **Cloud Run: Run Locally** run target from the Run/Debug configurations selector in the Navigation bar.\n2. Click **Cloud Run: Run Locally**.\n3. View the logs from your running service, streamed directly to the **output window**.\n4. Once deployment is complete, you can view your running service by following the\n URL displayed in your Event Log panel. In the example below, this URL is\n http://localhost:8080.\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]