Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Déployer un service Cloud Run avec Cloud Code pour IntelliJ
Cette page explique comment faire vos premiers pas avec Cloud Code.
Vous allez configurer un service Hello World qui s'exécute sur Cloud Run à l'aide d'un exemple d'application, déployer votre service sur Cloud Run et afficher l'état des ressources de votre service active.
Avant de commencer
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.
Cloud Code est fourni avec un ensemble de modèles d'exemples de code pour vous aider à démarrer rapidement. Pour créer un service à l'aide d'un exemple existant :
Dans l'IDE, ouvrez File > New Project (Fichier > Nouveau projet) et sélectionnez Cloud Code: Cloud Run.
Sélectionnez le langage de programmation de votre exemple d'application, puis cliquez sur Suivant.
Attribuez un nom à votre projet, puis cliquez sur Terminer.
Cloud Code clone l'exemple d'application, ouvre le projet que vous venez de créer et crée les configurations d'exécution Cloud Run nécessaires.
Si vous avez choisi un exemple d'application Java, cliquez sur Load Maven project (Charger un projet Maven) lorsque vous y êtes invité.
Vous pouvez maintenant exécuter votre service Hello World. Cloud Code surveille les modifications apportées à votre système de fichiers afin que vous puissiez modifier et réexécuter votre service quasiment en temps réel.
Déployer votre service dans Cloud Run
Pour déboguer votre service, procédez comme suit :
Choisissez la configuration d'exécution créée automatiquement, Cloud Run: Deploy, dans le sélecteur de configuration d'exécution/de débogage de la barre de navigation.
Cliquez sur Exécuter.
La fenêtre "Edit configuration" (Modifier la configuration) s'affiche.
Définissez votre ID de projet Google Cloud .
Choisissez une région pour votre plate-forme de déploiement.
Ce guide de démarrage rapide utilise l'option de plate-forme par défaut, Cloud Run
(fully managed) (Cloud Run (entièrement géré)), comme Plate-forme de déploiement.
Cliquez sur Run (Exécuter).
Cliquez sur l'URL affichée dans la fenêtre de sortie pour voir le service en cours d'exécution.
Toujours dans la même fenêtre, vous pouvez cliquer sur l'URL des journaux pour afficher l'état du service (métriques, détails des révisions, etc.).
Afficher l'état des ressources
Pour afficher l'état des ressources de votre service en cours d'exécution, procédez comme suit :
Accédez à l'explorateur Cloud Run. Vous pouvez y accéder à partir du panneau latéral situé à droite.
Pour afficher les propriétés d'un service ou d'une révision, cliquez sur ce service ou cette révision dans l'explorateur.
Pour afficher les journaux d'une révision, effectuez un clic droit sur la révision, puis cliquez sur View Cloud Logs (Afficher les journaux Cloud).
Nettoyer
Si vous avez créé un projet pour ce démarrage rapide, veillez à le supprimer pour éviter des frais inutiles :
Accédez à la page "Projets" de la console Google Cloud :
Service Cloud Run : pour supprimer un service Cloud Run, accédez à Cloud Run dans la console Google Cloud à l'aide du menu de navigation. Sélectionnez le service que vous souhaitez supprimer, puis cliquez sur Supprimer.
Effectuer un nettoyage
Pour éviter que les ressources utilisées sur cette page soient facturées sur votre compte Google Cloud , procédez comme suit :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/05 (UTC)."],[[["\u003cp\u003eCloud Code for IntelliJ allows you to deploy a "Hello World" service to Cloud Run using a sample application, which can be created through a collection of code samples.\u003c/p\u003e\n"],["\u003cp\u003eDeploying the service involves selecting the automatically created "Cloud Run: Deploy" configuration, setting the Google Cloud project ID and region, and then running the deployment, after which you can view the live service.\u003c/p\u003e\n"],["\u003cp\u003eThe status of a running service's resources can be viewed by navigating to the Cloud Run Explorer in the sidebar panel and selecting the specific service or revision.\u003c/p\u003e\n"],["\u003cp\u003eYou can clean up by deleting the project created for the quickstart or deleting specific resources like the container image and Cloud Run service, to avoid incurring unnecessary charges.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code offers the ability to add Google Cloud APIs and client libraries to your project, customize your run configurations with advanced settings, and run a kubernetes application.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Deploy a Cloud Run service with Cloud Code for IntelliJ\n\nDeploy a Cloud Run service with Cloud Code for IntelliJ\n=======================================================\n\nThis page shows you how to get started with Cloud Code.\n\nYou'll set up a Hello World service that runs on Cloud Run using\na sample application, deploy your service to Cloud Run, and\nview the status of your live service's resources.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Run API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=run.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Run API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=run.googleapis.com)\n\n1. Install [Git](https://git-scm.com/downloads) so that Cloud Code can perform Git operations, like cloning a sample.\n2. Install the [Cloud Code plugin](/code/docs/intellij/install#installing) if you haven't already.\n\n\u003cbr /\u003e\n\nCreating a service\n------------------\n\nCloud Code comes with a collection of\n[code sample](https://github.com/GoogleCloudPlatform/cloud-code-samples#readme)\ntemplates to get you started quickly. To create a new service using an existing\nsample:\n\n1. In your IDE, open **File** \\\u003e **New Project** and then select **Cloud Code: Cloud Run**.\n2. Select the programming language for your sample application and then click **Next** .\n3. Name your project and then click **Finish**.\n\n Cloud Code clones the sample application, opens your newly\n created project for use, and creates the necessary Cloud Run\n run configurations.\n4. If you chose a Java sample application, when prompted, click\n **Load Maven project**.\n\nYou can now run your Hello World service. Cloud Code watches your\nfile system for changes so that you can edit and rerun your service in near real\ntime.\n\nDeploying your service to Cloud Run\n-----------------------------------\n\nTo deploy your service, follow these steps:\n\n1. Choose the automatically created run configuration, **Cloud Run: Deploy**, from the Run/Debug configurations selector in the Navigation bar.\n2. Click **Run**. This brings up the Edit configuration window.\n3. Set your Google Cloud project ID.\n4. Choose a region for your deployment platform.\n\n This quickstart uses the default platform option, **Cloud Run\n (fully managed)**, as the Deployment Platform.\n5. Click **Run**.\n\n6. View your running service by following the URL displayed in the\n **output window**.\n\n7. You can also view the status of your service (metrics, revision details,\n and more) by following the logs URL displayed in the output window.\n\nViewing resource status\n-----------------------\n\nTo view the status of your running service's resources, follow these steps:\n\n1. Navigate to the Cloud Run Explorer. It can be accessed from\n the sidebar panel on the right.\n\n2. To display a service or revision's properties, click the service or revision\n in the explorer.\n\n3. To view a revision's logs, right-click the revision and then click **View Cloud Logs**.\n\nCleaning up\n-----------\n\nIf you created a project for this quickstart, be sure to delete it to avoid\nunnecessary charges:\n\n1. Go to the Projects page in the Google Cloud console:\n\n [Go to the Projects page](https://console.cloud.google.com/project)\n2. Select the project you created for this quickstart and then click\n **Delete**.\n\n This shuts down the project and schedules it for deletion.\n\nIf you're using a pre-existing project and would like to delete resources\nyou created for this quickstart:\n\n- **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 Artifact Registry](/artifact-registry/pricing). To delete your image, follow the steps in [Deleting images](/artifact-registry/docs/docker/manage-images#deleting_images).\n- **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**.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\nWhat's next\n-----------\n\n- Add [Google Cloud APIs and client libraries](/code/docs/intellij/client-libraries) to your project.\n- Customize your run configurations with [advanced settings](/code/docs/intellij/deploying-a-cloud-run-app).\n- Try creating and [running a Kubernetes application with\n Cloud Code](/code/docs/intellij/deploy-kubernetes-app)."]]