Deploy a Cloud Run service with Cloud Code for IntelliJ
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.
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 Google Cloud project.
-
Enable the Cloud Run API.
-
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 Google Cloud project.
-
Enable the Cloud Run API.
- Install Git so that Cloud Code can perform Git operations, like cloning a sample.
- Install the Cloud Code plugin if you haven't already.
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.
- 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.
Click Run.
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.
Cleaning up
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 Google Cloud console using the navigation menu. Select the service you'd like to delete and then click Delete.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
What's next
- 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.