Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mit der Compute Engine-Integration von Cloud Code können Sie sich die Compute Engine-VMs ansehen, auf denen Ihre Anwendungen ausgeführt werden, SSH-Verbindungen zu Ihren VMs herstellen, Anwendungsprotokolle aufrufen und Dateien auf eine VM hochladen.
In diesem Dokument erfahren Sie, wie Sie mit Cloud Code in Ihrer IDE auf die Compute Engine zugreifen und Ihre VM-Instanzen verwalten.
VMs ansehen
So rufen Sie VMs in Ihrem Google Cloud Projekt und die VM-Instanzdetails in der Google Cloud Konsole auf:
Melden Sie sich in Ihrer IDE in Cloud Code an, falls Sie das noch nicht getan haben, und wählen Sie Ihr Google Cloud Projekt aus.
Wenn Sie sich die VM-Instanzen in Ihrem Google Cloud Projekt ansehen möchten, klicken Sie in der Aktivitätsleiste der IDE auf Cloud Code und maximieren Sie dann den Explorer Compute Engine.
Wenn Sie die Details der VM-Instanz in der Google Cloud Console aufrufen möchten, klicken Sie mit der rechten Maustaste auf die VM-Instanz und wählen Sie In der Cloud Console öffnen aus.
Verbindung zu einer VM herstellen
So stellen Sie mit Cloud Code über das integrierte IDE-Terminal und SSH eine Verbindung zur VM-Instanz in Ihrer IDE her:
Wenn Sie eine Verbindung zu einer VM-Instanz herstellen möchten, bewegen Sie den Mauszeiger im Compute Engine-Explorer auf die VM-Instanz und klicken Sie auf TerminalSSH öffnen oder klicken Sie mit der rechten Maustaste auf die VM-Instanz und wählen Sie SSH öffnen aus.
Ein Terminal mit Informationen zur Remote-Instanz wird angezeigt.
Wenn die Verbindung zur VM-Instanz fehlschlägt:
Windows- und Linux-Nutzer finden unter Fehlerbehebung bei SSH-Fehlern Informationen zu häufigen Fehlern, die beim Herstellen einer SSH-Verbindung zu einer VM auftreten können, sowie zu Möglichkeiten zur Behebung von Fehlern und zur Diagnose fehlgeschlagener SSH-Verbindungen.
macOS-Nutzer sehen nach dem Drücken einer beliebigen Taste, um die Fehlermeldung im Terminal zu entfernen, ein Dialogfeld mit einer Fehlermeldung. Klicken Sie auf Fehlerbehebung, um Informationen zum Problem und zu möglichen Lösungen im Terminal aufzurufen. Wenn Sie die Dokumentation zur Fehlerbehebung bei SSH aufrufen möchten, klicken Sie auf Weitere Informationen.
Anwendungslogs auf einer VM ansehen
So rufen Sie die Anwendungsprotokolle einer VM-Instanz auf:
Wenn Sie die Anwendungsprotokolle einer VM-Instanz in Cloud Code aufrufen möchten, klicken Sie mit der rechten Maustaste auf die VM-Instanz und wählen Sie Logs ansehen aus.
Das Fenster „Loganzeige“ wird in Ihrer IDE angezeigt. Dort können Sie nach Protokolltyp, Zeit, Schweregrad und Instanz filtern.
Wenn Sie Logs in Echtzeit ansehen möchten, aktivieren Sie die Option Streaming.
Wenn Sie die Protokollierungsseite für eine bestimmte VM-Instanz in der Google Cloud Console aufrufen möchten, klicken Sie auf open_in_new (Im Browser öffnen).
Datei auf eine VM hochladen
So kopieren Sie Anwendungsdateien aus Ihrer lokalen IDE in Ihre Remote-VM-Instanz:
Wenn Sie eine Datei auf eine VM hochladen möchten, bewegen Sie den Mauszeiger im Cloud Code-Explorer Compute Engine auf die VM-Instanz und klicken Sie auf cloud_uploadDatei über SCP hochladen oder klicken Sie mit der rechten Maustaste auf die VM-Instanz und wählen Sie Datei über SCP hochladen aus.
Rufen Sie die Datei auf, die Sie hochladen möchten, und klicken Sie auf Hochladen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-05 (UTC)."],[[["\u003cp\u003eCloud Code enables you to view, manage, and connect to Compute Engine VMs directly within your IDE.\u003c/p\u003e\n"],["\u003cp\u003eYou can establish SSH connections to your VMs using Cloud Code's built-in terminal, with troubleshooting resources available for connection issues.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code allows you to view application logs from your VM instances within the IDE's Logs Viewer, including real-time streaming and filtering options.\u003c/p\u003e\n"],["\u003cp\u003eWith Cloud Code, you can upload files from your local machine to Linux VMs via SCP, facilitating application deployment and file transfer.\u003c/p\u003e\n"]]],[],null,["# Manage VMs in Cloud Code for VS Code\n\nWith Cloud Code's Compute Engine integration, you can view the Compute Engine VMs running your applications, establish connections to your VMs using SSH, view application logs, and upload files to a VM.\n\n\u003cbr /\u003e\n\nThis document shows you how to access Compute Engine with\nCloud Code in your IDE and manage your VM instances.\n\nView VMs\n--------\n\nTo view VMs in your Google Cloud project and the VM instance details in\nthe Google Cloud console, follow these steps:\n\n1. In your IDE, sign into Cloud Code if you haven't already, and\n select your Google Cloud project.\n\n2. To view VM instances in your Google Cloud project, in the activity bar\n of your IDE, click **Cloud Code** and then expand the\n **Compute Engine** explorer.\n\n3. To view the VM instance details in the Google Cloud console, right-click the\n VM instance and select **Open in Cloud Console**.\n\nConnect to a VM\n---------------\n\nTo connect to the VM instance in your IDE with Cloud Code using the\nbuilt-in IDE terminal and SSH, follow these steps:\n\n1. To connect to a VM instance, in the **Compute Engine** explorer, hold the\n pointer over the VM instance and click\n terminal **Open SSH** or right-click\n the VM instance and select **Open SSH**.\n\n A terminal appears, displaying information about the remote instance.\n2. If the connection to the VM instance fails:\n\n - For Windows and Linux users, see\n [Troubleshooting SSH errors](/compute/docs/troubleshooting/troubleshooting-ssh-errors)\n for common errors that you might run into when connecting to a VM using SSH,\n ways to resolve errors, and methods for diagnosing failed SSH connections.\n\n - For macOS users, after pressing any key to clear the error message in the\n terminal, an error message dialog appears. To view\n information in the terminal about the issue and potential resolutions,\n click **Troubleshoot** . Or, to view the\n [Troubleshooting SSH errors](/compute/docs/troubleshooting/troubleshooting-ssh-errors)\n documentation, click **Learn more**.\n\nView application logs on a VM\n-----------------------------\n\nTo view the application logs of a VM instance, follow these steps:\n\n1. To view the application logs of a VM instance in Cloud Code,\n right-click the VM instance and select **View Logs**.\n\n The Logs Viewer window appears in your IDE, allowing you to filter by log\n type, time, severity, and instance.\n2. To view logs in real time, turn on the **Streaming** toggle.\n\n3. To view the logging page for a particular VM instance in the Google Cloud console,\n click open_in_new\n **Open in browser**.\n\nUpload a file to a VM\n---------------------\n\nTo copy application files from your local IDE to your remote VM instance, follow\nthese steps:\n| **Note:** Cloud Code only supports [transferring files to Linux\n| VMs](/compute/docs/instances/transfer-files). For additional options for Windows machines, see [Transfer files to Windows VMs](/compute/docs/instances/transfer-files-windows).\n\n1. To upload a file to a VM, in the Cloud Code **Compute Engine**\n explorer, hold the pointer over the VM instance and click\n cloud_upload\n **Upload File via SCP** , or right-click the VM instance and select **Upload\n File via SCP**.\n\n2. Navigate to the file that you want to upload and click **Upload**."]]