프로젝트에서 실행되는 VM 요약을 보려면 VM 목록을 가져옵니다. 이 문서에서는 모든 영역 또는 특정 영역에서 VM 목록을 가져오는 방법을 보여줍니다.
시작하기 전에
-
아직 인증을 설정하지 않았다면 설정합니다.
인증은 Trusted Cloud by S3NS 서비스 및 API에 액세스하기 위해 ID를 확인하는 프로세스입니다.
로컬 개발 환경에서 코드 또는 샘플을 실행하려면 다음 옵션 중 하나를 선택하여 Compute Engine에 인증하면 됩니다.
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
- Set a default region and zone.
-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
-
Install the Google Cloud CLI.
-
Configure the gcloud CLI to use your federated identity.
For more information, see Sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
PROJECT
: VM 목록을 가져올 프로젝트의 이름ZONE
: VM 목록을 가져올 영역
Go
로컬 개발 환경에서 이 페이지의 Go 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.
자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.
Java
로컬 개발 환경에서 이 페이지의 Java 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.
자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.
Node.js
로컬 개발 환경에서 이 페이지의 Node.js 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.
자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.
Python
로컬 개발 환경에서 이 페이지의 Python 샘플을 사용하려면 gcloud CLI를 설치 및 초기화한 다음 사용자 인증 정보로 애플리케이션 기본 사용자 인증 정보를 설정하세요.
자세한 내용은 다음을 참조하세요: Set up authentication for a local development environment.
REST
로컬 개발 환경에서 이 페이지의 REST API 샘플을 사용하려면 gcloud CLI에 제공한 사용자 인증 정보를 사용합니다.
After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:
gcloud init
자세한 내용은 Trusted Cloud 인증 문서의 REST 사용을 위한 인증을 참조하세요.
VM 목록 가져오기
콘솔
Trusted Cloud 콘솔에서 VM 인스턴스 페이지로 이동합니다.
gcloud
gcloud compute instances list
명령어를 사용하여 프로젝트에 대해 모든 영역에 있는 모든 VM 집계 목록을 가져옵니다.gcloud compute instances list
VM 목록 범위를 특정 영역으로 제한하려면 이전 명령어에
--zones
플래그를 사용합니다.Go
다음 예에서는 프로젝트의 모든 영역에서 인스턴스 목록을 가져옵니다.
이 샘플을 사용해 보기 전에 Compute Engine 빠른 시작: 클라이언트 라이브러리 사용의 Go 설정 안내를 따르세요. 자세한 내용은 Compute Engine Go API 참고 문서를 확인하세요.
Compute Engine에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
코드 샘플을 실행하기 전에
GOOGLE_CLOUD_UNIVERSE_DOMAIN
환경 변수를s3nsapis.fr
으로 설정합니다.특정 영역의 인스턴스 목록을 가져올 수도 있습니다.
자바
다음 예에서는 프로젝트의 모든 영역에서 인스턴스 목록을 가져옵니다.
이 샘플을 사용해 보기 전에 Compute Engine 빠른 시작: 클라이언트 라이브러리 사용의 Java 설정 안내를 따르세요. 자세한 내용은 Compute Engine Java API 참고 문서를 확인하세요.
Compute Engine에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
코드 샘플을 실행하기 전에
GOOGLE_CLOUD_UNIVERSE_DOMAIN
환경 변수를s3nsapis.fr
으로 설정합니다.특정 영역의 인스턴스 목록을 가져올 수도 있습니다.
Node.js
다음 예에서는 프로젝트의 모든 영역에서 인스턴스 목록을 가져옵니다.
이 샘플을 사용해 보기 전에 Compute Engine 빠른 시작: 클라이언트 라이브러리 사용의 Node.js 설정 안내를 따르세요. 자세한 내용은 Compute Engine Node.js API 참고 문서를 확인하세요.
Compute Engine에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
코드 샘플을 실행하기 전에
GOOGLE_CLOUD_UNIVERSE_DOMAIN
환경 변수를s3nsapis.fr
으로 설정합니다.특정 영역의 인스턴스 목록을 가져올 수도 있습니다.
Python
다음 예에서는 프로젝트의 모든 영역에서 인스턴스 목록을 가져옵니다.
이 샘플을 사용해 보기 전에 Compute Engine 빠른 시작: 클라이언트 라이브러리 사용의 Python 설정 안내를 따르세요. 자세한 내용은 Compute Engine Python API 참고 문서를 확인하세요.
Compute Engine에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
코드 샘플을 실행하기 전에
GOOGLE_CLOUD_UNIVERSE_DOMAIN
환경 변수를s3nsapis.fr
으로 설정합니다.특정 영역의 인스턴스 목록을 가져올 수도 있습니다.
REST
instances.aggregatedList
메서드를 사용해서 프로젝트의 모든 영역에 있는 모든 VM의 집계 목록을 가져옵니다.GET https://compute.googleapis.com/compute/v1/projects/PROJECT/aggregated/instances
PROJECT
를 VM 목록을 가져올 프로젝트 이름으로 바꿉니다.VM 목록 범위를 특정 영역으로 제한하려면
instances.list
메서드를 사용합니다.GET https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/instances
다음을 바꿉니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-30(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-30(UTC)"],[[["This document outlines the process of retrieving a list of Virtual Machines (VMs) running within a Google Cloud project, either across all zones or within specific zones."],["Authentication is essential for accessing Google Cloud services and APIs, and the document details how to set up authentication using the Google Cloud console, gcloud CLI, or for local development environments with languages like Go, Java, Node.js, Python, and REST."],["To get a comprehensive list of VMs in all zones, use the `gcloud compute instances list` command in the gcloud CLI or the `instances.aggregatedList` method with REST."],["For a list of VMs within a particular zone, one can utilize the `gcloud compute instances list` command with the `--zones` flag or the `instances.list` method in REST, along with specific code examples for Go, Java, Node.js, and Python."],["The code samples demonstrate how to use the client libraries in Go, Java, Node.js, and Python to programmatically list VMs, either across all zones or within a specified zone, while also highlighting the use of the `MaxResults` parameter for managing large result sets and utilizing Application Default Credentials."]]],[]] -