Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Secara default, pengguna di project Anda dapat membuat persistent disk atau menyalin image menggunakan salah satu image publik dan image apa pun yang dapat diakses oleh principal melalui peran IAM.
Namun, dalam beberapa situasi, Anda mungkin ingin membatasi prinsipal agar mereka hanya dapat membuat disk boot dari image yang berisi software yang disetujui yang memenuhi persyaratan kebijakan atau keamanan Anda.
Gunakan fitur Image tepercaya untuk menentukan kebijakan organisasi yang
mengizinkan prinsipal membuat persistent disk hanya dari image di project
tertentu.
Jika Anda belum melakukannya, siapkan autentikasi.
Autentikasi adalah
proses yang digunakan untuk memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API.
Untuk menjalankan kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Menginstal Google Cloud CLI.
Setelah penginstalan,
lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
Kebijakan image tepercaya tidak mencegah pengguna membuat resource image di project lokal mereka.
Menetapkan batasan akses gambar
Terapkan kebijakan akses gambar dengan menetapkan batasan compute.trustedImageProjects
pada project, folder, atau organisasi Anda. Anda harus memiliki izin untuk mengubah kebijakan organisasi guna menetapkan batasan ini. Misalnya,
roles/orgpolicy.policyAdmin
memiliki izin untuk menetapkan batasan ini. Untuk mengetahui informasi selengkapnya tentang cara mengelola
kebijakan di tingkat project, folder, atau organisasi, lihat
Menggunakan batasan.
Anda dapat menetapkan batasan pada semua image publik yang tersedia di Compute Engine.
Untuk mengetahui daftar nama project image, lihat Detail sistem operasi.
Anda juga dapat membatasi image Machine Learning (ML) yang tersedia di Compute Engine dengan menggunakan project ml-images. Jika Anda menggunakan
Akses VPC Serverless,
beri project Anda izin untuk menggunakan image VM Compute Engine dari project serverless-vpc-access-images.
Gunakan konsol Google Cloud atau Google Cloud CLI untuk menetapkan batasan pada akses image.
Konsol
Misalnya, untuk menetapkan batasan di tingkat project, lakukan hal berikut:
Dari daftar kebijakan, klik Tentukan project gambar tepercaya.
Halaman Policy details akan ditampilkan.
Di halaman Detail kebijakan, klik Kelola Kebijakan. Halaman Edit kebijakan akan ditampilkan.
Di halaman Edit policy, pilih Customize.
Untuk Penerapan kebijakan, pilih opsi penerapan. Untuk mengetahui informasi tentang pewarisan dan hierarki resource, lihat Memahami Evaluasi Hierarki.
Klik Tambahkan Aturan.
Dalam daftar Nilai kebijakan, Anda dapat memilih apakah kebijakan organisasi ini harus mengizinkan akses ke semua project gambar, menolak akses ke semua project gambar, atau Anda dapat menentukan kumpulan project kustom untuk mengizinkan atau menolak akses.
Untuk menetapkan aturan kebijakan, selesaikan salah satu opsi berikut:
Untuk mengizinkan pengguna membuat disk boot dari semua image publik, pilih Izinkan Semua.
Untuk mencegah pengguna membuat boot disk dari semua image publik, pilih Tolak Semua.
Untuk menentukan serangkaian image publik tertentu yang dapat digunakan pengguna untuk membuat boot disk, pilih Kustom.
Kolom Jenis kebijakan dan Nilai kustom akan ditampilkan.
Di daftar Jenis kebijakan, pilih Izinkan atau Tolak.
Di kolom Nilai kustom, masukkan nama project image
menggunakan format projects/IMAGE_PROJECT.
Ganti IMAGE_PROJECT dengan project image yang ingin Anda tetapkan batasan.
Anda dapat menambahkan beberapa project gambar. Untuk setiap project gambar yang ingin Anda tambahkan, klik Tambahkan dan masukkan nama project gambar.
Untuk menyimpan aturan, klik Selesai.
Untuk menyimpan dan menerapkan kebijakan organisasi, klik Simpan.
Buka file policy.yaml di editor teks dan ubah batasan
compute.trustedImageProjects. Tambahkan batasan yang Anda perlukan dan hapus batasan yang tidak lagi Anda perlukan. Setelah selesai mengedit file, simpan perubahan Anda. Misalnya,
Anda dapat menetapkan entri batasan berikut dalam file kebijakan Anda:
[[["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."],[[["\u003cp\u003eTrusted image policies allow you to restrict the creation of persistent disks to only use images from specific projects, helping to enforce security and policy requirements.\u003c/p\u003e\n"],["\u003cp\u003eYou can set image access constraints by using the \u003ccode\u003ecompute.trustedImageProjects\u003c/code\u003e constraint at the project, folder, or organization level, allowing you to control which images can be used for boot disks.\u003c/p\u003e\n"],["\u003cp\u003eTrusted image policies do not affect access to custom images within your local project or image files in Cloud Storage buckets, and they do not prevent users from creating image resources in their local projects.\u003c/p\u003e\n"],["\u003cp\u003eImage access constraints can be configured to allow or deny the use of all public images or to specify a custom set of image projects that users can create boot disks from.\u003c/p\u003e\n"],["\u003cp\u003eTo implement constraints, you can use either the Google Cloud console or the gcloud CLI, with the latter requiring you to modify a policy.yaml file that outlines your specific restrictions.\u003c/p\u003e\n"]]],[],null,["# Setting up trusted image policies\n\n*** ** * ** ***\n\nBy default, users in your project can create persistent disks or copy\nimages using any of the\n[public images](/compute/docs/images#os-compute-support)\nand any images that\n[principals can access through IAM roles](/compute/docs/images/sharing-images-across-projects).\nHowever, in some situations you might want to restrict principals so that they\ncan create boot disks only from images that contain approved software that meets\nyour policy or security requirements.\n\nUse the Trusted image feature to define an organization policy that\nallows principals to create persistent disks only from images in specific\nprojects.\n\nTo restrict the locations where your images can be used, read\n[restricting use of your shared images, disks, and snapshots](/compute/docs/images/sharing-images-across-projects#restrict).\n\nBefore you begin\n----------------\n\n- Read the [Using constraints](/resource-manager/docs/organization-policy/using-constraints) page to learn about managing policies at organization level.\n- Read the [Understanding hierarchy evaluation](/resource-manager/docs/organization-policy/understanding-hierarchy) page to learn how organization policies propagate.\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nLimitations\n-----------\n\n- Trusted image policies do not restrict access to the following images:\n\n - [Custom images](/compute/docs/images#custom_images) in your local project.\n\n - Image files in Cloud Storage buckets.\n\n- Trusted image policies do not prevent users from creating image resources in\n their local projects.\n\nSet image access constraints\n----------------------------\n\nEnact an image access policy by setting a `compute.trustedImageProjects`\nconstraint on your project, your folder, or your organization. You must have\npermission to modify organization policies to set these constraints. For\nexample,\n[`roles/orgpolicy.policyAdmin`](/resource-manager/docs/access-control-org)\nhas permission to set these constraints. For more information about managing\npolicies at the project, folder, or organization level, see\n[Using constraints](/resource-manager/docs/organization-policy/using-constraints).\n\nYou can set constraints on all public images available on Compute Engine.\nFor a list of image project names, see [Operating systems details](/compute/docs/images/os-details).\nYou can also restrict the Machine Learning (ML) images that are available on\nCompute Engine by using the `ml-images` project. If you are using\n[Serverless VPC Access](/vpc/docs/configure-serverless-vpc-access#errors),\ngrant your project permission to use Compute Engine VM images from the\n`serverless-vpc-access-images` project.\n\nUse the Google Cloud console or Google Cloud CLI to set constraints on image access. \n\n### Console\n\nFor example, to set a constraint at the project level, do the following:\n\n1. Go to the **Organization policies** page.\n\n [Go to Organization policies](https://console.cloud.google.com/iam-admin/orgpolicies/)\n2. From the policies list, click **Define trusted image projects** .\n The **Policy details** page displays.\n\n3. On the **Policy details** page, click **Manage Policy** . The **Edit policy**\n page displays.\n\n4. On the **Edit policy** page, select **Customize**.\n\n5. For **Policy enforcement** , select an enforcement option. For information\n about inheritance and the resource hierarchy, see\n [Understanding Hierarchy Evaluation](/resource-manager/docs/organization-policy/understanding-hierarchy).\n\n6. Click **Add rule**.\n\n7. In the **Policy values** list, you can select whether this organization\n policy should allow access to all image projects, deny access to all image\n projects, or you can specify a custom set of projects to allow or deny\n access to.\n\n To set the policy rule, complete one of the following options:\n - To allow users to create boot disks from all public images, select **Allow All**.\n - To restrict users from creating boot disk from all public images, select **Deny All**.\n - To specify a select set of public images that users can create boot\n disks from, select **Custom** .\n A **Policy type** and **Custom values** field displays.\n\n 1. In the **Policy type** list, select **Allow** or **Deny**.\n 2. In the **Custom values** field, enter the name of the image project\n using the `projects/`\u003cvar translate=\"no\"\u003eIMAGE_PROJECT\u003c/var\u003e format.\n\n Replace \u003cvar translate=\"no\"\u003eIMAGE_PROJECT\u003c/var\u003e with the image project\n you want to set the constraint on.\n\n You can add multiple image projects. For each image project that\n you want to add, click **Add** and enter the image project name.\n8. To save the rule, click **Done**.\n\n9. To save and apply the organization policy, click **Save**.\n\nFor more information about creating organization policies, see\n[Creating and managing organization policies](/resource-manager/docs/organization-policy/creating-managing-policies).\n\n### gcloud\n\nFor example, to set a constraint at the project level, do the following:\n\n1. Get the existing policy settings for your project by using the [`resource-manager org-policies describe`](/sdk/gcloud/reference/resource-manager/org-policies/describe) command.\n\n ```\n gcloud resource-manager org-policies describe \\\n compute.trustedImageProjects --project=PROJECT_ID \\\n --effective \u003e policy.yaml\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID.\n2. Open the `policy.yaml` file in a text editor and modify the\n `compute.trustedImageProjects` constraint. Add the restrictions that you\n need and remove the restrictions that you no longer require. When you\n have finished editing the file, save your changes. For example,\n you might set the following constraint entry in your policy file:\n\n ```\n constraint: constraints/compute.trustedImageProjects\n listPolicy:\n allowedValues:\n - projects/debian-cloud\n - projects/cos-cloud\n deniedValues:\n - projects/IMAGE_PROJECT\n ```\n\n Replace \u003cvar translate=\"no\"\u003eIMAGE_PROJECT\u003c/var\u003e with the name of the image project that you want to restrict in your project.\n\n Optionally, you might want to deny access to all images outside of\n the custom images in your project. For that situation, use the\n following example: \n\n ```\n constraint: constraints/compute.trustedImageProjects\n listPolicy:\n allValues: DENY\n ```\n\n \u003cbr /\u003e\n\n3. Apply the `policy.yaml` file to your project. If your\n [organization or folder has existing constraints](/resource-manager/docs/organization-policy/understanding-policies),\n those constraints might conflict with project-level constraints that\n you set. To apply the constraint, use the [`resource-manager org-policies set-policy`](/sdk/gcloud/reference/resource-manager/org-policies/set-policy) command.\n\n ```\n gcloud resource-manager org-policies set-policy \\\n policy.yaml --project=PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID.\n\nWhen you have finished configuring the constraints,\ntest those constraints to ensure that they create the restrictions that you\nneed.\n\nWhat's next\n-----------\n\n- Learn more about the [Organization Policy Service](/resource-manager/docs/organization-policy/overview).\n- See what [public images](/compute/docs/images) are available for you to use by default.\n- [Share your private image](/compute/docs/images/sharing-images-across-projects) with other projects.\n- Learn how to [restrict use of your shared images, disks, and snapshots](/compute/docs/images/sharing-images-across-projects#restrict).\n- Learn how to [start an instance from an image](/compute/docs/instances/creating-and-starting-an-instance#startinginstancwithimage)."]]