서비스 사용 설정 관리
계층적 서비스 활성화를 사용하면 Google Cloud 리소스 계층 구조를 통해 상속되는 서비스 사용 설정을 관리할 수 있습니다. 자세한 내용은 개요를 참고하세요.
이 문서에서는 Google Cloud CLI를 사용하여 프로젝트, 폴더, 조직의 서비스 사용 설정을 관리하는 방법을 보여줍니다.
시작하기 전에
- 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.
-
Install the Google Cloud CLI.
-
외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.
-
gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.
gcloud init -
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith 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_IDwith your Google Cloud project name.
-
이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.
-
Verify that billing is enabled for your Google Cloud project.
-
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 theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable serviceusage.googleapis.com
-
Install the Google Cloud CLI.
-
외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.
-
gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.
gcloud init -
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 theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith 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_IDwith your Google Cloud project name.
-
이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.
-
Verify that billing is enabled for your Google Cloud project.
-
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 theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable serviceusage.googleapis.com
- 관리할 Google Cloud 리소스를 표시하지 않으면 이 문서의 명령어는 기본적으로 현재 프로젝트를 사용합니다. 예를 들어
gcloud beta services list --enabled는 현재 프로젝트에 사용 설정된 서비스 목록을 반환합니다.다음과 같이 현재 프로젝트 ID를 가져올 수 있습니다.
gcloud config list --format='text(core.project)'
-
서비스를 나열합니다.
-
serviceusage.effectivepolicy.get -
serviceusage.services.list -
serviceusage.services.get
-
-
서비스 사용 설정:
-
serviceusage.consumerpolicy.get -
serviceusage.consumerpolicy.update -
serviceusage.groups.listExpandedMembers
-
-
서비스 사용 중지:
-
serviceusage.consumerpolicy.get -
serviceusage.consumerpolicy.update -
serviceusage.consumerpolicy.analyze
-
다음 플래그 중 하나를 지정해야 합니다.
--available를 사용하여 소비를 위해 사용 설정할 수 있는 서비스를 나열합니다.--enabled를 사용하여 사용 설정된 서비스를 나열합니다.
기타 플래그를 사용하여 나열된 서비스를 필터링하고 제한할 수 있습니다.
SERVICE: 사용 설정할 서비스의 이름입니다. 여러 서비스를 사용 설정하려면 공백으로 구분된 서비스 이름을 사용합니다. 예를 들어 다음 명령어는 API 키와 BigQuery 서비스를 모두 사용 설정합니다.gcloud beta services enable apikeys.googleapis.com bigquery.googleapis.comPROJECT_ID: Google Cloud 프로젝트 ID 또는 플래그를 생략하여 현재 프로젝트를 기본값으로 설정합니다.SERVICE: 사용 설정할 서비스의 이름입니다. 여러 서비스를 사용 설정하려면 공백으로 구분된 서비스 이름을 사용합니다(예:gcloud beta services enable apikeys.googleapis.com bigquery.googleapis.com).FOLDER_ID: Google Cloud 폴더 IDSERVICE: 사용 설정할 서비스의 이름입니다. 여러 서비스를 사용 설정하려면 공백으로 구분된 서비스 이름을 사용합니다(예:gcloud beta services enable apikeys.googleapis.com bigquery.googleapis.com).ORGANIZATION_ID: Google Cloud 조직 리소스 ID입니다.--async는 진행 중인 작업이 완료되기를 기다리지 않고 즉시 반환합니다.--skip-dependency를 사용하여 서비스 종속 항목을 사용 설정하지 않도록 합니다. 그렇지 않으면 모든 서비스 종속 항목이 기본적으로 사용 설정됩니다.서비스 종속 항목을 검사할 수 있습니다. 자세한 내용은 서비스 종속 항목 나열을 참고하세요.
--validate-only를 사용하여 실제로 작업을 실행하지 않고 사용 설정을 검증합니다.이미 사용 설정된 서비스를 사용 설정하려고 하면 서비스가 이미 사용 설정되어 있으며 소비자 정책에 표시된다는 오류가 표시됩니다. (서비스는 이미 사용 설정되어 있지만 종속 항목이 사용 설정되어 있지 않은 경우 명령이 성공합니다.)
폴더 또는 조직 수준에서 서비스를 사용 설정하면 조직 정책 제약 조건
constraints/serviceuser.services이 예상대로 작동하지 않을 수 있습니다. 대신 리소스 서비스 사용량 제한 제약 조건을 사용하는 것이 좋습니다. 자세한 내용은 리소스 사용량 제한을 참고하세요.Google Cloud 서비스의 서비스 계정을 생성하고 관리합니다.Google Cloud 이러한 서비스 계정을 서비스 에이전트라고 합니다.
service account not found오류가 발생하면gcloud beta services identity create명령어를 사용하여 서비스 에이전트를 만들어야 할 수 있습니다.SERVICE: 사용 중지할 서비스의 이름입니다. 여러 서비스를 사용 중지하려면 공백으로 구분된 서비스 이름을 사용합니다(예:gcloud beta services disable apikeys.googleapis.com bigquery.googleapis.com).PROJECT_ID: Google Cloud 프로젝트 ID 또는 플래그를 생략하여 현재 프로젝트를 기본값으로 설정합니다.SERVICE: 사용 중지할 서비스의 이름입니다. 여러 서비스를 사용 중지하려면 공백으로 구분된 서비스 이름을 사용합니다(예:gcloud beta services disable apikeys.googleapis.com bigquery.googleapis.com).FOLDER_ID: Google Cloud 폴더 IDSERVICE: 사용 중지할 서비스의 이름입니다. 여러 서비스를 사용 중지하려면 공백으로 구분된 서비스 이름을 사용합니다(예:gcloud beta services disable apikeys.googleapis.com bigquery.googleapis.com).ORGANIZATION_ID: Google Cloud 조직 리소스 ID입니다.--async는 진행 중인 작업이 완료되기를 기다리지 않고 즉시 반환합니다.--bypass-api-usage-check를 사용하여 사용량 확인을 우회합니다. 그렇지 않으면 사용 중지하려는 서비스가 지난 30일 동안 사용되었거나 지난 3일 동안 사용 설정된 경우 시스템에서 오류를 반환합니다.다음 플래그 중 하나를 지정할 수 있습니다.
--bypass-dependency-service-check: 종속 항목 확인을 우회합니다. 사용 중지하는 서비스에 종속된 사용 설정된 서비스는 사용 설정된 상태로 유지됩니다.--disable-dependency-services를 선택하여 서비스를 사용 중지하고 사용 중지하려는 서비스에 종속된 사용 설정된 서비스를 사용 중지합니다.
서비스 종속 항목을 검사할 수 있습니다. 자세한 내용은 서비스 종속 항목 나열을 참고하세요.
--force를 사용하여 서비스에 종속된 서비스가 사용 설정되어 있거나, 지난 30일 동안 서비스가 사용되었거나, 지난 3일 동안 서비스가 사용 설정된 경우에도 계속 진행합니다. 종속 서비스도 사용 중지됩니다.--bypass-api-usage-check,--bypass-dependency-service-check,--disable-dependency-services플래그는 모두--force플래그보다 우선합니다.--disable-dependency-services및--bypass-api-usage-check플래그를 모두 사용하는 것은--force플래그를 사용하는 것과 동일합니다. 서비스와 종속 항목이 사용량을 확인하지 않고 사용 중지됩니다.--validate-only를 사용하여 실제로 작업을 실행하지 않고 사용 중지 여부를 확인합니다.- 종속 항목 없이 BigQuery 서비스를 사용 설정하는 경우:
gcloud beta services enable bigquery.googleapis.com --skip-dependency
출력:
Operation [operations/ucpat.p39-581601899707-73a57d57-aa46-4d0b-a5ee-57034a42f2b3] complete. Result: { "@type":"type.googleapis.com/google.api.serviceusage.with Hierarchical Service Activationbeta.ConsumerPolicy", "createTime":"2025-01-31T20:17:37.272343Z", "enableRules":[ { "services":[ "services/apikeys.googleapis.com", "services/compute.googleapis.com", "services/oslogin.googleapis.com", "services/serviceusage.googleapis.com", "services/bigquery.googleapis.com" ] } ], "etag":"W/\"W9nsVJK0V1m7ee7tM7pFDg==\"", "name":"projects/PROJECT_ID/consumerPolicies/default", "updateTime":"2025-09-11T23:05:22.758394Z" }
- 종속 항목과 함께 BigQuery 서비스를 사용 설정합니다.
gcloud beta services enable bigquery.googleapis.com
출력:
Operation [operations/ucpat.p39-581601899707-73192b0f-053c-46ee-911a-7eca6b8fe899] complete. Result: { "@type":"type.googleapis.com/google.api.serviceusage.with Hierarchical Service Activationbeta.ConsumerPolicy", "createTime":"2025-01-31T20:17:37.272343Z", "enableRules":[ { "services":[ "services/apikeys.googleapis.com", "services/compute.googleapis.com", "services/oslogin.googleapis.com", "services/serviceusage.googleapis.com", "services/cloudresourcemanager.googleapis.com", "services/dataplex.googleapis.com", "services/bigquery.googleapis.com", "services/bigquerystorage.googleapis.com", "services/bigqueryconnection.googleapis.com", "services/analyticshub.googleapis.com", "services/bigquerymigration.googleapis.com", "services/dataform.googleapis.com", "services/bigquerydatapolicy.googleapis.com", "services/bigquerydatatransfer.googleapis.com", "services/bigqueryreservation.googleapis.com" ] } ], "etag":"W/\"FDXMAIdsBW7BrXjL7oP6FA==\"", "name":"projects/PROJECT_ID/consumerPolicies/default", "updateTime":"2025-09-12T19:44:23.675769Z" }
- 활성 종속 항목이 있는 BigQuery 서비스를 사용 중지하려고 시도:
gcloud beta services disable bigquery.googleapis.com
오류 메시지:
ERROR: (gcloud.beta.services.disable) The services are depended on by the following active service(s) {"bigquery.googleapis.com": ["services/bigquerystorage.googleapis.com"]} . Please remove the active dependent services or provide the --disable-dependency-services flag to disable them, or --bypass-dependency-service-check to ignore this check.
- 최근 사용량이 있는 BigQuery 서비스를 사용 중지하려고 시도:
gcloud beta services disable bigquery.googleapis.com --disable-dependency-services
오류 메시지:
ERROR: (gcloud.beta.services.disable) The operation "operations/ucpat.p39-581601899707-d35c2e2b-d2a3-47af-a1c0-033ed65df236" resulted in a failure "The services bigquery.googleapis.com,bigquerystorage.googleapis.com have usage in the last 30 days or were enabled in the past 3 days. Please specify force if you want to proceed with the destructive policy change.
- BigQuery 서비스 및 종속 항목을 사용 중지하고 사용 확인을 우회합니다.
gcloud beta services disable bigquery.googleapis.com --disable-dependency-services --bypass-api-usage-check
출력:
Operation [operations/ucpat.p39-581601899707-5c02aa04-7ad7-4eb6-a6a1-dc68653bcdb4] complete. Result: { "@type":"type.googleapis.com/google.api.serviceusage.v2beta.ConsumerPolicy", "createTime":"2025-01-31T20:17:37.272343Z", "enableRules":[ { "services":[ "services/analyticshub.googleapis.com", "services/apikeys.googleapis.com", "services/bigqueryconnection.googleapis.com", "services/bigquerydatapolicy.googleapis.com", "services/bigquerydatatransfer.googleapis.com", "services/bigquerymigration.googleapis.com", "services/bigqueryreservation.googleapis.com", "services/cloudresourcemanager.googleapis.com", "services/compute.googleapis.com", "services/dataform.googleapis.com", "services/dataplex.googleapis.com", "services/oslogin.googleapis.com", "services/serviceusage.googleapis.com" ] } ], "etag":"W/\"TqbPaELDHlZQOj7As1P06g==\"", "name":"projects/PROJECT_ID/consumerPolicies/default", "updateTime":"2025-09-30T21:39:40.746125Z" }
- 정책을 관리하려면 소비자 정책 관리를 참고하세요.
- 서비스 종속 항목을 검사하려면 서비스 종속 항목 나열을 참고하세요.
필요한 역할
서비스 사용 설정을 관리하는 데 필요한 권한을 얻으려면 관리자에게 타겟 리소스에 대한 서비스 사용 설정 관리자 (roles/serviceusage.serviceUsageAdmin) IAM 역할을 부여해 달라고 요청하세요.
역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.
이 사전 정의된 역할에는 서비스 사용 설정을 관리하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.
필수 권한
서비스 사용 설정을 관리하려면 다음 권한이 필요합니다.
커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.
서비스 나열
gcloud beta services list 명령어를 사용하여 프로젝트, 폴더 또는 조직에 사용 설정되어 있거나 사용 가능한 Google API 및 서비스를 나열할 수 있습니다.
서비스 사용 설정 및 사용 가능 여부는 리소스 상위 항목에서 상속될 수 있습니다. 리소스의 사용 설정된 서비스에는 리소스 자체에서 사용 설정된 서비스와 모든 리소스 상위 항목에서 사용 설정된 서비스가 포함됩니다.
프로젝트
gcloud beta services list --enabled \
--project=PROJECT_ID
PROJECT_ID를 Google Cloud 프로젝트 ID로 바꿉니다.
또는 플래그를 생략하여 현재 프로젝트를 기본값으로 설정합니다.
폴더
gcloud beta services list --enabled \
--folder=FOLDER_ID
FOLDER_ID를 Google Cloud 폴더 ID로 바꿉니다.
조직
gcloud beta services list --enabled \
--organization=ORGANIZATION_ID
ORGANIZATION_ID를 Google Cloud 조직 리소스 ID로 바꿉니다.
다음에 유의하세요.
서비스 사용 설정
gcloud beta services enable 명령어를 사용하여 프로젝트, 폴더 또는 조직에 하나 이상의 서비스를 사용 설정할 수 있습니다.
이 명령어는 타겟 리소스에서 ConsumerPolicy를 업데이트합니다. 자세한 내용은 일반 사용자 정책 관리를 참고하세요.
프로젝트
gcloud beta services enable SERVICE \
--project=PROJECT_ID
다음을 바꿉니다.
폴더
gcloud beta services enable SERVICE \
--folder=FOLDER_ID
다음을 바꿉니다.
조직
gcloud beta services enable SERVICE \
--organization=ORGANIZATION_ID
다음을 바꿉니다.
지원되는 플래그:
다음에 유의하세요.
서비스 사용 중지
gcloud beta services disable 명령어를 사용하여 프로젝트, 폴더 또는 조직의 서비스를 하나 이상 사용 중지할 수 있습니다.
이 명령어는 타겟 리소스에서 ConsumerPolicy를 업데이트합니다. 자세한 내용은 일반 사용자 정책 관리를 참고하세요.
프로젝트
gcloud beta services disable SERVICE \
--project=PROJECT_ID
다음을 바꿉니다.
폴더
gcloud beta services disable SERVICE \
--folder=FOLDER_ID
다음을 바꿉니다.
조직
gcloud beta services disable SERVICE \
--organization=ORGANIZATION_ID
다음을 바꿉니다.
지원되는 플래그: