Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mengaktifkan dan Menonaktifkan Service
Halaman ini menjelaskan cara mengaktifkan dan menonaktifkan layanan untuk project Google Cloud .
Anda dapat menggunakan Penggunaan Layanan untuk mengaktifkan atau menonaktifkan layanan apa pun yang tersedia
untuk project Anda, termasuk layananGoogle Cloud publik dan layanan pribadi yang dibuat
menggunakan Cloud Endpoints. Untuk informasi selengkapnya tentang
perbedaan antara API dan layanan publik dan pribadi, lihat
Layanan Publik dan Pribadi.
Untuk sebagian besar kasus penggunaan operasional, cara termudah untuk mengaktifkan dan menonaktifkan layanan
adalah menggunakan konsol Google Cloud . Jika perlu membuat skrip, Anda juga dapat menggunakan Google Cloud CLI. Jika Anda perlu memprogram terhadap
Service Usage API, sebaiknya gunakan salah satu
library klien yang kami sediakan. Untuk bereksperimen dengan API,
Anda dapat mengikuti petunjuk alternatif dalam panduan ini dan menggunakan perintah curl
untuk menguji API tanpa menyiapkan lingkungan pengembangan aplikasi
lengkap.
Sebelum memulai
Untuk mengaktifkan dan menonaktifkan API dan layanan yang Anda perlukan:
Jika Anda ingin menggunakan contoh curl dalam panduan ini, pastikan Anda mengikuti
petunjuk untuk menyelesaikan penyiapan awal di
Memulai. Langkah-langkah ini mencakup
menentukan gcurl, yang merupakan alias diautentikasi untuk perintah curl
standar, dan menentukan variabel lingkungan PROJECT_NUMBER.
Mengaktifkan layanan
Mengaktifkan layanan menggunakan kuota dari
metrik kuota serviceusage.googleapis.com/mutate_requests. Kuota default yang tersedia adalah 2 kueri per detik (QPS).
Pilih Google Cloud project tempat Anda ingin mengaktifkan
API dengan melakukan salah satu tindakan berikut:
Klik project Google Cloud di bagian Pilih project terbaru.
Gunakan browser project Google Cloud dengan melakukan langkah-langkah
berikut:
Klik Select project untuk membuka Google Cloud browser project.
Temukan project Anda, lalu klik Google Cloud nama project.
Klik Buka untuk membuka project.
Klik API yang ingin Anda aktifkan. Jika Anda memerlukan bantuan untuk menemukan API, gunakan kotak Telusuri API & Layanan di dekat bagian atas halaman. Halaman
yang menjelaskan API akan muncul.
Klik tombol Enable.
gcloud
Jalankan perintah berikut untuk mengaktifkan layanan Pub/Sub API di project saat ini:
gcloud services enable pubsub.googleapis.com
Perintah ini menghasilkan output yang mirip dengan berikut ini:
Waiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete...
Operation finished successfully.
Anda dapat menggunakan perintah berikut untuk mendapatkan detail operasi:
Anda dapat mengaktifkan satu layanan menggunakan
metode
services.enable. Anda dapat mengaktifkan antara 2 hingga 20 layanan dalam satu operasi menggunakan metode services.batchEnable.
Mengaktifkan satu layanan
Perintah berikut mengaktifkan layanan Pub/Sub API di project Anda:
Metode
services.enable
menampilkan resource
Operasi yang Berjalan Lama, yang mewakili pekerjaan yang sedang berlangsung di server. Setiap operasi memiliki
nama resource yang unik. Misalnya, berikut adalah operasi
dengan nama operations/acf.2e2fcfce-8327-4984-9040-a67777082687:
Jika ingin mengaktifkan beberapa layanan API di project, Anda dapat mengeluarkan perintah enable untuk setiap layanan API satu per satu, atau Anda dapat mengeluarkan satu perintah enable batch dan menentukan beberapa API. Misalnya, untuk mengaktifkan layanan Pub/Sub dan Dataflow API di project Anda:
Seperti services.enable, services.batchEnable
menampilkan resource operasi, yang dapat Anda polling menggunakan name-nya.
Menonaktifkan layanan
Menonaktifkan layanan menggunakan kuota dari
metrik kuota serviceusage.googleapis.com/mutate_requests. Kuota default yang tersedia adalah 2 kueri per detik (QPS).
Anda dapat menonaktifkan API untuk project kapan saja, meskipun biaya yang tertunda akan
tetap ditagih ke akun Anda dan Anda akan ditagih untuk penggunaan API yang dapat ditagih
di project Anda. Untuk informasi selengkapnya, lihat
API dan Penagihan.
Banyak layanan seperti Cloud Storage dan BigQuery mengenakan biaya untuk menyimpan data. Menonaktifkan akses API layanan tidak akan menghapus data pokok yang akan terus ditagih. Jika Anda ingin menghentikan penggunaan layanan dan menghentikan semua
tagihan mendatang, pastikan untuk menghapus semua data yang terkait dengan layanan sebelum
menonaktifkan akses API layanan.
Jika Anda menonaktifkan GKE API, cluster apa pun yang berjalan di project akan ditangguhkan. Setelah 30 hari, cluster yang ditangguhkan akan dihapus. Untuk mengaktifkan kembali cluster yang ditangguhkan, aktifkan GKE API. Mungkin perlu waktu hingga 24 jam agar cluster diaktifkan kembali.
Pilih Google Cloud project tempat Anda ingin menonaktifkan API dengan melakukan salah satu tindakan berikut:
Klik project Google Cloud di bagian Pilih project terbaru.
Gunakan browser project Google Cloud dengan melakukan langkah-langkah
berikut:
Klik Select project untuk membuka Google Cloud browser project.
Temukan project Anda, lalu klik Google Cloud nama project.
Klik Buka untuk membuka project.
Klik API yang ingin dinonaktifkan. Jika Anda memerlukan bantuan untuk menemukan API, gunakan kotak Telusuri API & Layanan di dekat bagian atas halaman. Halaman
yang menjelaskan API akan muncul.
Klik stopDisable API.
gcloud
Jalankan perintah berikut untuk menonaktifkan layanan Pub/Sub API untuk project Anda saat ini:
gcloud services disable pubsub.googleapis.com
Perintah ini menghasilkan output yang mirip dengan berikut ini:
Waiting for async operation operations/acf.e9d0943b-55d9-4ac0-8af4-745e1b8983f8 to complete...
Operation finished successfully.
Anda dapat menggunakan perintah berikut untuk mendapatkan detail operasi:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[],[],null,["# Enabling and Disabling Services\n===============================\n\nThis page describes how to enable and disable services for a Google Cloud project.\nYou can use Service Usage to enable or disable any available service\nfor your projects, including public\n[Google Cloud services](/terms/services) and private services created\nusing [Cloud Endpoints](/endpoints/docs). For more information on the\ndifferences between public and private APIs and services, see\n[Public and Private Services](/service-usage/docs/public-vs-private).\n\nFor most operational use cases, the simplest way to enable and disable services\nis to use the Google Cloud console. If you need to create scripts, you can also use the\nGoogle Cloud CLI. If you need to program against the\nService Usage API, we recommend that you use one of our provided\n[client libraries](/service-usage/docs/libraries). To experiment with the API,\nyou can follow the alternative instructions in this guide and use the `curl`\ncommand to test the API without setting up a full application development\nenvironment.\n\nBefore you begin\n----------------\n\nTo enable and disable APIs and services you need:\n\n- A Google Cloud project. To learn how to create a Google Cloud project, see [Creating and Managing Projects](/resource-manager/docs/creating-managing-projects).\n- The correct [Identity and Access Management](/iam) permissions. To learn about the IAM requirements for Service Usage, see [Access Control](/service-usage/docs/access-control).\n- To install the [Google Cloud CLI](/sdk/docs/install).\n- If you want to use the `curl` examples in this guide, make sure you follow the instructions to complete the initial setup in [Getting Started](/service-usage/docs/set-up-development-environment). These steps include defining `gcurl`, which is an authenticated alias for the standard `curl` command, and defining the environment variable `PROJECT_NUMBER`.\n\nEnabling services\n-----------------\n\nEnabling services uses quota from the\n`serviceusage.googleapis.com/mutate_requests` quota metric. The default\navailable quota is 2 queries per second (QPS). \n\n### console\n\nTo enable an API for a project:\n\n1. Go to the Google Cloud console [API Library](https://console.cloud.google.com/project/_/apis/library) page. \n [Go to the API Library page](https://console.cloud.google.com/project/_/apis/library)\n2. Select the Google Cloud project where you want to enable\n an API by performing one of the following:\n\n - Click on a Google Cloud project under **Select a recent project**.\n\n - Use the Google Cloud project browser by performing the following\n steps:\n\n 1. Click **Select project** to open the Google Cloud project browser.\n 2. Find your project and then click on the Google Cloud project name.\n 3. Click **Open** to open the project.\n3. Click the API you want to enable. If you need help finding the API, use\n the **Search for APIs \\& Services** box near the top of the page. A page\n describing the API appears.\n\n4. Click the **Enable** button.\n\n### gcloud\n\nRun the following command to enable the Pub/Sub API service in your\ncurrent project: \n\n```\ngcloud services enable pubsub.googleapis.com\n```\n\nThe command produces output similar to the following: \n\n```\nWaiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete...\nOperation finished successfully.\n```\n\nYou can use the following command to get the operation details: \n\n```\ngcloud services operations describe operations/acf.2e2fcfce-8327-4984-9040-a67777082687\n```\n\n### curl\n\nYou can enable a single service using the\n[`services.enable`](/service-usage/docs/reference/rest/v1/services/enable)\nmethod. You can enable between 2 and 20 services in a single operation using\nthe [`services.batchEnable`](/service-usage/docs/reference/rest/v1/services/batchEnable)\nmethod.\n\n### Enable a single service\n\nThe following command enables the Pub/Sub API service on your\nproject: \n\n gcurl -d '{}' \"https://serviceusage.googleapis.com/v1/projects/${PROJECT_NUMBER}/services/pubsub.googleapis.com:enable\"\n\nThe\n[`services.enable`](/service-usage/docs/reference/rest/v1/services/enable)\nmethod returns a\n[Long Running Operation](/service-usage/docs/reference/rest/v1/operations)\nresource, which represents ongoing work on the server. Each operation has\na unique resource name. For example, here is an operation\nwith the name `operations/acf.2e2fcfce-8327-4984-9040-a67777082687`: \n\n {\n \"name\": \"operations/acf.2e2fcfce-8327-4984-9040-a67777082687\"\n }\n\nTo poll the operation status by using the Service Usage\n[`operations.get`](/service-usage/docs/reference/rest/v1/operations/get)\nmethod, pass the name of the operation to the API: \n\n OPERATION_NAME=\"operations/acf.2e2fcfce-8327-4984-9040-a67777082687\"\n gcurl \"https://serviceusage.googleapis.com/v1/${OPERATION_NAME}\"\n\n### Enable multiple services at once\n\nIf you want to enable multiple API services on your project, you can issue\nan enable command for each API service individually, or you can issue one\nbatch enable command and specify multiple APIs. For example, to enable both\nthe Pub/Sub and Dataflow API services on your project: \n\n gcurl -d '{\n \"serviceIds\": [\"pubsub.googleapis.com\", \"dataflow.googleapis.com\"]\n }' \"https://serviceusage.googleapis.com/v1/projects/${PROJECT_NUMBER}/services:batchEnable\"\n\nLike `services.enable`, [`services.batchEnable`](/service-usage/docs/reference/rest/v1/services/batchEnable)\nreturns an operation resource, which you can poll by using its `name`.\n| **Note:** The process for enabling APIs can vary. Some APIs prompt you to accept their Terms of Service before you can enable them. Some APIs are in preview mode and require special signup and whitelisting before you can use them. Other APIs might ask for additional information, such as your organization's contact information and the name of the application you are developing. When more information is requested, it will not be shared outside of Google; it's used to help Google understand how the API is being used and as a secondary contact should we need to contact you regarding your use of the service.\n\nDisabling services\n------------------\n\nDisabling services uses quota from the\n`serviceusage.googleapis.com/mutate_requests` quota metric. The default\navailable quota is 2 queries per second (QPS).\n\nYou can disable an API for a project at any time, although any pending fees will\nstill be charged to your account and you'll be charged for any billable API use\nin your projects. For more information, see\n[APIs and Billing](https://support.google.com/cloud/answer/6158867).\n\nMany services like Cloud Storage and BigQuery charge to store data. Disabling a\nservice's API access does not delete the underlying data which will continue\nto be billed. If your intent is to discontinue using a service and stop all\nfuture charges, be sure to delete all data associated with the service before\ndisabling the service's API access.\n\nIf you disable the GKE API, any running clusters in the project become suspended. After 30 days, the suspended clusters are deleted. To reinstate your suspended clusters, enable the GKE API. It may take up to 24 hours for the clusters to be reinstated.\n**Note:** In v1 of the API, if you attempt to disable a service that other enabled services depend on, the call will fail. The API call to disable the service will result in an error message. To disable the specified service and all of the services that depend on it, set the `disable_dependent_services` parameter on the [`services.disable`](/service-usage/docs/reference/rest/v1/services/disable) request to `true`. \n\n### console\n\nTo disable an API for a project:\n\n1. Go to the Google Cloud console [API Dashboard](https://console.cloud.google.com/project/_/apis/dashboard) page. \n [Go to the API Dashboard page](https://console.cloud.google.com/project/_/apis/dashboard)\n2. Select the Google Cloud project where you want to disable\n an API by performing one of the following:\n\n - Click on a Google Cloud project under **Select a recent project**.\n\n - Use the Google Cloud project browser by performing the following\n steps:\n\n 1. Click **Select project** to open the Google Cloud project browser.\n 2. Find your project and then click on the Google Cloud project name.\n 3. Click **Open** to open the project.\n3. Click the API you want to disable. If you need help finding the API, use\n the **Search for APIs \\& Services** box near the top of the page. A page\n describing the API appears.\n\n4. Click *stop* **Disable API**.\n\n### gcloud\n\nRun the following command to disable the Pub/Sub API service for\nyour current project: \n\n```\ngcloud services disable pubsub.googleapis.com\n```\n\nThe command produces output similar to the following: \n\n```\nWaiting for async operation operations/acf.e9d0943b-55d9-4ac0-8af4-745e1b8983f8 to complete...\nOperation finished successfully.\n```\n\nYou can use the following command to get the operation details: \n\n```\ngcloud services operations describe operations/acf.e9d0943b-55d9-4ac0-8af4-745e1b8983f8\n```\n\n### curl\n\nThe following command disables the Pub/Sub API service on\nyour project: \n\n gcurl -d '{}' \"https://serviceusage.googleapis.com/v1/projects/${PROJECT_NUMBER}/services/pubsub.googleapis.com:disable\"\n\nLike `services.enable`, [`services.disable`](/service-usage/docs/reference/rest/v1/services/disable)\nreturns an operation resource, which you can poll by using its `name`."]]