This page shows you how to get started with Cloud Code.
You'll set up a Hello World service that runs on Cloud Run using a sample application, deploy your service to Cloud Run, and view the status of your live service's resources.
If you're running this quickstart on Apple M-series silicon, your application is built using Cloud Build, which can incur charges. For more information, see Cloud Code support for Apple M-series silicon.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.
Make sure that billing is enabled for your Cloud project. Learn how to confirm that billing is enabled for your project.
- Enable the Cloud Run API.
Installing Cloud Code
To install the Cloud Code for IntelliJ plugin:
If you're running Cloud Code on Apple M-series silicon, install Rosetta 2. This allows Cloud Code to install kubectl as a managed dependency.
If you prefer not to install Rosetta 2, turn off managed dependencies (IntelliJ IDEA > Preferences > Tools > Cloud Code > Dependencies) and install your own ARM version of kubectl as described in Custom versions of dependencies.
- For all Cloud platforms, ensure the
Docker client (authenticated with your
Docker registry) is installed on the
PATHof your machine. (Its folder should be visible under a directory in your
PATH.) To check if you already have Docker installed, run
- Cloud Code automatically installs other necessary dependencies.
- For all Cloud platforms, ensure the Docker client (authenticated with your Docker registry) is installed on the
Open IntelliJ IDEA (or any supported JetBrains IDE).
Once you have your IDE open, refresh this page.
You can now install the Cloud Code plugin directly by clicking the button below:
The button launches an installation dialog within your open IDE. Click OK to set up Cloud Code.
Creating a service
To create a new service using an existing sample:
- In your IDE, open File > New Project and then select Cloud Code: Cloud Run.
- Select the programming language for your sample application and then click Next.
Name your project and then click Finish.
Cloud Code clones the sample application, opens your newly created project for use, and creates the necessary Cloud Run run configurations.
If you chose a Java sample application, when prompted, click Load Maven project.
You can now run your Hello World service. Cloud Code watches your filesystem for changes so that you can edit and rerun your service in near real time.
Deploying your service to Cloud Run
To deploy your service, follow these steps:
Choose the automatically created run configuration, Cloud Run: Deploy, from the Run/Debug configurations selector in the Navigation bar.
If you're running this quickstart on Apple M-series silicon, your application is built using Cloud Build. For information about Cloud Build pricing, see Pricing.
Click Run . This brings up the Edit configuration window.
Set your Google Cloud project ID.
Choose a region for your deployment platform.
This quickstart uses the default platform option, Cloud Run (fully managed), as the Deployment Platform.
View your running service by following the URL displayed in the output window.
You can also view the status of your service (metrics, revision details, and more) by following the logs URL displayed in the output window.
Viewing resource status
To view the status of your running service's resources, follow these steps:
Navigate to the Cloud Run Explorer. It can be accessed from the sidebar panel on the right.
To display a service or revision's properties, click the service or revision in the explorer.
To view a revision's logs, right-click the revision and then click View Cloud Logs.
If you created a project for this quickstart, be sure to delete it to avoid unnecessary charges:
Go to the Projects page in the Google Cloud Console:
Select the project you created for this quickstart and then click Delete.
This shuts down the project and schedules it for deletion.
If you're using a pre-existing project and would like to delete resources you created for this quickstart:
- Container image: While Cloud Run doesn't charge when the service isn't in use, you might still be charged for storing the container image in Container Registry. To delete your image, follow the steps in Deleting images.
- Cloud Run service: To delete a Cloud Run service, navigate to Cloud Run in the Cloud Console using the navigation menu. Select the service you'd like to delete and then click Delete.
- Add Google Cloud APIs and client libraries to your project.
- Customize your run configurations with advanced settings.
- Try creating and running a Kubernetes application with Cloud Code.