애셋 보기
이 문서에서는 Cloud Shell에서 Cloud 애셋 인벤토리와 Google Cloud CLI를 사용하여 애셋을 보는 방법을 보여줍니다.
시작하기 전에
Cloud 애셋 인벤토리를 사용하려면 먼저 Cloud 애셋 인벤토리 API를 사용 설정하고 권한을 설정해야 합니다.
- 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.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Enable the Cloud Asset Inventory API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Enable the Cloud Asset Inventory API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
사용자에게 다음 역할 부여: Cloud 애셋 소유자(
roles/cloudasset.owner
) Google Cloud 콘솔에서 VM 인스턴스 페이지로 이동합니다.
인스턴스 만들기를 클릭합니다.
인스턴스의 이름을 입력합니다.
만들기를 클릭합니다.
Google Cloud 콘솔에서
Cloud Shell 활성화를 클릭합니다.Cloud Shell에서 다음 명령어를 실행합니다.
gcloud asset list \ --project=PROJECT_ID \ --asset-types=compute.googleapis.com/Instance \ --content-type=resource
PROJECT_ID
를 애셋을 나열할 프로젝트의 ID로 바꿉니다.이전 코드 샘플에서는
compute.googleapis.com/Instance
애셋 유형이 Compute Engine VM 인스턴스를 나열하는 데만 사용됩니다. 모든 애셋 유형을 보려면 애셋 유형을 참조하세요.콘텐츠 유형
resource
도 설정되었습니다. 그러면 응답에서 반환되어야 하는resource
메타데이터도 지정됩니다. 콘텐츠 유형이 설정되지 않으면 애셋 이름, 마지막 업데이트 시간, 속해 있는 프로젝트와 같은 각 애셋에 대한 기본 정보만 반환됩니다.Google Cloud 콘솔에서 VM 인스턴스 페이지로 이동합니다.
만든 VM 인스턴스의 이름과 동일한 행에서
작업 더보기를 클릭합니다.삭제를 클릭한 후 삭제되었는지 확인합니다.
- 애셋 보기와 관련된 더 많은 옵션을 알아보려면 애셋 나열을 참조하세요.
애셋 보기
원하는 프로젝트에서 Cloud 애셋 인벤토리에서 볼 수 있도록 Compute Engine VM 인스턴스를 만듭니다.
프로젝트의 모든 VM 인스턴스를 나열합니다.
삭제
이 페이지에서 사용한 리소스 비용이 Google Cloud 계정에 청구되지 않도록 하려면 다음 단계를 수행합니다.