서비스 종속 항목 나열

계층적 서비스 활성화를 사용하면 Google Cloud 리소스 계층 구조를 통해 상속되는 서비스 사용 설정을 관리할 수 있습니다. 자세한 내용은 개요를 참고하세요.

많은 Google Cloud 서비스가 작동하려면 다른 서비스가 필요합니다. 계층적 서비스 활성화를 사용하여 서비스를 사용 설정하면 필요한 종속 항목이 ConsumerPolicy에 자동으로 추가됩니다. 서비스 종속 항목 그룹에는 이러한 종속 서비스가 포함되어 있으며, 이를 나열하여 더 잘 이해하고 관리할 수 있습니다.

이 문서에서는 Google Cloud CLI를 사용하여 프로젝트, 폴더, 조직의 서비스 종속 항목을 나열하는 방법을 보여줍니다.

시작하기 전에

  1. 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.
  2. Install the Google Cloud CLI.

  3. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  4. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  5. Create or select 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 role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  6. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.

  7. Verify that billing is enabled for your Google Cloud project.

  8. Enable the Service Usage API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable serviceusage.googleapis.com
  9. Install the Google Cloud CLI.

  10. 외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  11. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  12. Create or select 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 role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  13. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.

  14. Verify that billing is enabled for your Google Cloud project.

  15. Enable the Service Usage API:

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    gcloud services enable serviceusage.googleapis.com
  16. 관리할 Google Cloud 리소스를 표시하지 않으면 이 문서의 명령어는 기본적으로 현재 프로젝트를 사용합니다. 예를 들어 gcloud beta services groups list-members bigquery.googleapis.com dependencies은 현재 프로젝트의 구성원을 나열합니다.

    다음과 같이 현재 프로젝트 ID를 가져올 수 있습니다.

    gcloud config list --format='text(core.project)'
  17. 필요한 역할

    서비스 종속 항목을 나열하는 데 필요한 권한을 얻으려면 관리자에게 타겟 리소스에 대한 서비스 사용량 뷰어 (roles/serviceusage.serviceUsageViewer) IAM 역할을 부여해 달라고 요청하세요. 역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

    이 사전 정의된 역할에는 서비스 종속 항목을 나열하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.

    필수 권한

    서비스 종속 항목을 나열하려면 다음 권한이 필요합니다.

    • 종속 항목 그룹 구성원을 나열합니다. serviceusage.groups.listMembers
    • 확장된 종속 항목 그룹 구성원을 나열합니다. serviceusage.groups.listExpandedMembers

    커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.

    종속 항목 그룹 구성원 나열

    gcloud beta services groups list-members 명령어를 사용하여 프로젝트, 폴더 또는 조직의 서비스 종속 항목 그룹의 직접 구성원을 나열할 수 있습니다.

    프로젝트

    gcloud beta services groups list-members  SERVICE GROUP \
        --project=PROJECT_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 멤버를 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • PROJECT_ID: Google Cloud 프로젝트 ID 또는 플래그를 생략하여 현재 프로젝트를 기본값으로 설정합니다.

    폴더

    gcloud beta services groups list-members  SERVICE  GROUP \
        --folder=FOLDER_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 구성원을 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • FOLDER_ID: Google Cloud 폴더 ID

    조직

    gcloud beta services groups list-members  SERVICE  GROUP \
        --organization=ORGANIZATION_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 멤버를 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • ORGANIZATION_ID: Google Cloud 조직 리소스 ID입니다.

    기타 플래그를 사용하여 나열된 회원을 필터링하고 제한할 수 있습니다.

    확장된 종속 항목 그룹 구성원 나열

    gcloud beta services groups list-expanded-members 명령어를 사용하여 프로젝트, 폴더 또는 조직의 서비스 종속 항목 그룹에 속한 확장된 구성원을 나열할 수 있습니다.

    이 명령어는 중첩된 그룹의 종속 항목을 포함한 모든 종속 항목의 병합된 목록을 제공하기 위해 모든 종속 항목의 평면화된 목록을 반환합니다.

    프로젝트

    gcloud beta services groups list-expanded-members SERVICE GROUP \
        --project=PROJECT_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 구성원을 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • PROJECT_ID: Google Cloud 프로젝트 ID 또는 플래그를 생략하여 현재 프로젝트를 기본값으로 설정합니다.

    폴더

    gcloud beta services groups list-expanded-members SERVICE  GROUP \
        --folder=FOLDER_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 구성원을 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • FOLDER_ID: Google Cloud 폴더 ID

    조직

    gcloud beta services groups list-expanded-members SERVICE  GROUP \
        --organization=ORGANIZATION_ID
    

    다음을 바꿉니다.

    • SERVICE: 구성원을 나열할 서비스의 이름입니다.
    • GROUP: 구성원을 나열할 서비스 종속성 그룹의 이름입니다. 기본적으로 지원되는 그룹은 dependencies입니다.
    • ORGANIZATION_ID: Google Cloud 조직 리소스 ID입니다.

    기타 플래그를 사용하여 나열된 회원을 필터링하고 제한할 수 있습니다.

    예시

    직접 종속 항목 그룹 구성원 나열

    • 현재 프로젝트의 BigQuery 서비스 직접 종속 항목을 나열합니다.
      gcloud beta services groups list-members bigquery.googleapis.com dependencies

      출력:

      NAME: services/analyticshub.googleapis.com
      REASON: BigQuery depends on this group to allow users to exchange data and analytics assets.
      
      NAME: services/bigquery.googleapis.com
      REASON: The service representing BigQuery which owns this dependency group and depends on the other members of this group.
      
      NAME: services/bigqueryconnection.googleapis.com
      REASON: BigQuery depends on this group to allow users to manage connections to external data sources.
      
      NAME: services/bigquerydatapolicy.googleapis.com
      REASON: BigQuery depends on this group to allow users to manage their data policies.
      
      ...
    • 해당 서비스 종속 항목 그룹 없이 API 키 서비스의 종속 항목을 나열하려고 시도합니다.
      gcloud beta services groups list-members apikeys.googleapis.com dependencies --project=test-project

      출력:

      Listed 0 items.

    확장된 종속 항목 그룹 구성원 나열

    • 현재 프로젝트의 BigQuery 서비스 확장 종속 항목을 나열합니다.
      gcloud beta services groups list-expanded-members bigquery.googleapis.com dependencies

      출력:

      services/analyticshub.googleapis.com
      services/bigquery.googleapis.com
      services/bigqueryconnection.googleapis.com
      services/bigquerydatapolicy.googleapis.com
      services/bigquerydatatransfer.googleapis.com
      services/bigquerymigration.googleapis.com
      services/bigqueryreservation.googleapis.com
      services/bigquerystorage.googleapis.com
      services/cloudresourcemanager.googleapis.com
      services/dataform.googleapis.com
      services/dataplex.googleapis.com

    다음 단계