Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini memberikan detail tentang cara membuat dan memperbarui
label untuk project menggunakan Resource Manager API dan konsol Google Cloud . Dokumen ini memberikan
detail tentang cara memahami biaya menggunakan label dan layanan yang mendukung label.
Di halaman Kelola resource, pilih project yang ingin Anda tambahi label.
Di panel info, di tab Label, klik + Tambahkan label dan
masukkan kunci dan nilai label untuk setiap label yang ingin Anda tambahkan.
Setelah selesai menambahkan label, klik Simpan.
Setelah menambahkan label, Anda dapat memfilter project dengan mengetik kunci atau nilai label di
kotak filter di atas daftar project. Kotak filter akan menyarankan kunci dan nilai sehingga Anda dapat melihat pratinjau hasil.
REST
Untuk membuat project baru dengan label, tetapkan kolom labels saat Anda membuat project.
Setelah menambahkan label, Anda dapat memfilter project berdasarkan label. Untuk mengetahui detail tentang
penggunaan label untuk memfilter project, lihat Mencantumkan Project.
[[["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-08-18 UTC."],[],[],null,["# Create and update labels for projects\n\nThis document provides details on how to create and update\nlabels for projects using the Resource Manager API and the Google Cloud console. It provides\ndetails on how to understand costs using labels and the services that support labels.\n| **Note:** For more information about adding or updating labels on specific resources, such as Compute Engine instance and Cloud Storage buckets, see the corresponding product documentation of the resource.\n\n\nCreate labels for projects\n--------------------------\n\n\u003cbr /\u003e\n\n\n### Console\n\nTo add labels to a single project:\n\n1. Open the **Labels** page in the Google Cloud console.\n\n [Open the Labels page](https://console.cloud.google.com/projectselector/iam-admin/labels)\n2. Select your project from the **Select a project** drop-down.\n\n3. To add a new label entry, click **+ Add label** and enter a label key and\n value for each label you want to add.\n\n4. When you're finished adding labels, click **Save**.\n\nTo add labels for more than one project at the same time:\n\n1. Open the **Manage resources** page in the Google Cloud console.\n\n [Open the Manage resources page](https://console.cloud.google.com/cloud-resource-manager)\n2. On the **Manage resources** page, select the projects for\n which you want to add labels.\n\n3. In the info panel, in the **Labels** tab, click **+ Add label** and\n enter a label key and value for each label you want to add.\n\n4. When you're finished adding labels, click **Save**.\n\nAfter you add labels, you can filter projects by typing a label key or value in\nthe filter box above the projects list. The filter box will suggest keys and\nvalues so you can preview results.\n\n\u003cbr /\u003e\n\n\n### REST\n\nTo create a **new** project with a label, set the `labels` field when you create\nthe project.\n\nRequest: \n\n```text\nPOST https://cloudresourcemanager.googleapis.com/v3/projects\n\n{\n \"labels\": {\n \"color\": \"red\"\n },\n \"name\": \"myproject\",\n \"projectId\": \"our-project-123\"\n}\n```\n\nResponse: \n\n```text\n{\n \"projectNumber\": \"333197460082\",\n \"projectId\": \"our-project-123\",\n \"lifecycleState\": \"ACTIVE\",\n \"name\": \"myproject\",\n \"labels\": {\n \"color\": \"red\"\n },\n \"createTime\": \"2016-01-12T22:18:28.633Z\",\n}\n```\n\nTo add labels for **existing** projects:\n\n- Get the project using the [`projects.get()`](https://cloud.google.com/resource-manager/reference/rest/v3/projects/get) method.\n- Modify the `labels` field.\n- Update the project using the [`projects.patch()`](https://cloud.google.com/resource-manager/reference/rest/v3/projects/patch) method.\n\nOnce you add labels, you can filter projects based on labels. For details about\nusing labels to filter projects, see [Listing Projects](/resource-manager/docs/creating-managing-projects#listing_projects).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUpdate labels for projects\n--------------------------\n\n\u003cbr /\u003e\n\n\n### Console\n\nTo update labels for a single project:\n\n\u003cbr /\u003e\n\n1. Open the **Labels** page in the Google Cloud console.\n\n [Open the Labels page](https://console.cloud.google.com/projectselector/iam-admin/labels)\n2. Select your project from the **Select a project** drop-down.\n\n3. Update the labels for your project:\n\n 1. To edit a label, click the value that you want to edit, then make your desired changes.\n 2. To delete a label, hold the pointer over the key or value, then click delete .\n4. When you're finished updating labels, click **Save**.\n\nTo update labels for more than one project at the same time:\n\n1. Open the **Manage resources** page in the Google Cloud console.\n\n [Open the Manage resources page](https://console.cloud.google.com/cloud-resource-manager)\n2. On the **Manage resources** page, select the projects for\n which you want to update labels.\n\n3. In the info panel, click the **Labels** tab and update labels for the\n selected projects:\n\n 1. To edit a label, click the value that you want to edit, then make your desired changes.\n 2. To delete a label, hold the pointer over the key or value, then click delete .\n4. When you're finished updating labels, click **Save**.\n\n\u003cbr /\u003e\n\n\n### REST\n\nTo update a project's labels, do the following:\n\n- Get the `project` object using the\n [`projects.get()`](/resource-manager/reference/rest/v3/projects/get)\n method.\n\n- Modify the labels that you want to update.\n\n- Call the `projects.patch` method.\n\nThe following example updates the label `color:blue`:\n\nThe following code snippet changes the value of the `color` label from `blue`\nto `red`.\n\nRequest: \n\n PATCH https://cloudresourcemanager.googleapis.com/v3/projects/\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e\n {\n updateMask=labels\n }\n\nWhere \u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e is the name of the project you want\nto update.\n\nRequest JSON body: \n\n {\n \"labels\":\n {\n \"color\": \"red\"\n }\n }\n\nResponse: \n\n {\n \"projects\": [\n {\n \"name\": \"projects/123456789012\",\n \"parent\": \"folders/123456789012\",\n \"projectId\": \"my-project\",\n \"state\": \"ACTIVE\",\n \"displayName\": \"\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e\"\n \"createTime\": \"2013-11-13T20:31:53.308Z\"\n \"updateTime\": \"2013-11-13T20:35:42.308Z\"\n \"etag\": \"BwWUlZ6XEfY=\"\n \"labels\": {\n \"color\": \"red\"\n },\n }\n ]\n }\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]