Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara menetapkan region atau zona default untuk project Google Cloud konsol.
Saat membuat permintaan ke Compute Engine, Anda mungkin diminta untuk memberikan region atau zona, bergantung pada persyaratan khusus dari permintaan Anda. Setiap permintaan yang melibatkan resource regional mengharuskan Anda memberikan nama wilayah, dan permintaan apa pun yang melibatkan resource zonal mengharuskan Anda memberikan nama zona. Misalnya, Anda harus menentukan region saat membuat alamat IP eksternal statis, dan harus menentukan zona saat membuat instance mesin virtual (VM).
Saat Anda membuat project, Compute Engine akan otomatis memilih region dan zona default berdasarkan lokasi tempat Anda membuat project. Compute Engine mencoba memilih region dan zona yang dekat dengan asal project sehingga resource yang Anda buat memiliki latensi yang lebih rendah untuk pelanggan atau klien Anda. Jika ingin
membuat resource di region atau zona berbeda, Anda dapat mengganti pilihan
default.
Untuk mengetahui informasi selengkapnya tentang region dan zona, lihat Region dan zona.
Untuk mengetahui informasi selengkapnya tentang resource Compute Engine global, regional, dan zona, lihat Resource global, regional, dan zona.
Sebelum memulai
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:
Pengaruh region dan zona default terhadap project Anda
Setelan region dan zona default hanya memengaruhi alat klien, seperti Google Cloud CLI dan konsol Google Cloud . Saat Anda menggunakan alat ini untuk
membuat permintaan, alat tersebut akan membantu Anda mengelola resource dengan memilih
region dan zona default secara otomatis.
Saat Anda menggunakan konsol Google Cloud untuk membuat resource regional atau zona seperti alamat dan instance, Compute Engine akan menetapkan kolom region dan zona untuk Anda. Anda dapat menerima nilai yang telah diisi otomatis atau secara eksplisit mengubah salah satu atau kedua nilai.
Saat Anda menggunakan gcloud CLI, hapus penetapan flag --region dan --zone agar menggunakan properti region dan zona default untuk project baru.
Anda dapat mengubah setelan region dan zona default pada server metadata, mengganti region dan zona default secara lokal untuk gcloud CLI, atau mengganti setelan secara manual untuk setiap permintaan menggunakan gcloud CLI atau konsol Google Cloud .
Mencari region atau zona default
Server metadata berisi informasi metadata tentang project, termasuk project ID dan nama project. Anda dapat membuat kueri server metadata untuk mendapatkan
dan menggunakan informasi tentang project.
Jika Anda menentukan region dan zona default untuk project, Compute Engine akan menetapkan nilai ini dalam server metadata untuk project Anda.
Region dan zona default ditetapkan menggunakan nilai berikut:
google-compute-default-region
google-compute-default-zone
Untuk melihat setelan region dan zona default, jalankan perintah gcloud berikut, dengan mengganti PROJECT_ID dengan project ID Anda:
Cari nilai metadata region dan zona default dalam respons. Jika kunci dan nilai
google-compute-default-region dan google-compute-default-zone
tidak ada di respons, berarti tidak ada region atau zona default yang ditetapkan.
Mengubah region atau zona default
Tidak ada batasan region atau zona yang dapat Anda tetapkan untuk properti default. Misalnya, Anda dapat menetapkan zona default yang berada di luar region default. Periksa setelan region dan zona default saat membuat dan mengelola resource Anda.
Konsol
Untuk mengubah region atau zona default, ikuti langkah-langkah berikut:
Setelah Anda memperbarui metadata default dengan menggunakan metode apa pun, jalankan perintah
gcloud init untuk menginisialisasi ulang konfigurasi default Anda.
Gcloud CLI akan memperbarui setelan region dan zona default hanya setelah Anda menjalankan perintah gcloud init.
Untuk mengetahui informasi lebih lanjut mengenai cara menggunakan opsi gcloud CLI untuk menetapkan region dan zona default, baca artikel Menetapkan properti default.
[[["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-19 UTC."],[[["\u003cp\u003eThis page explains how to set and manage default regions and zones for your Google Cloud project, which are necessary for creating regional and zonal resources like static IP addresses and virtual machine instances.\u003c/p\u003e\n"],["\u003cp\u003eCompute Engine automatically selects a default region and zone based on the project's origin, but users can override these defaults to create resources in different locations, to reduce latency.\u003c/p\u003e\n"],["\u003cp\u003eDefault region and zone settings affect client tools like the Google Cloud CLI and Google Cloud console by automatically pre-populating these values when creating resources, but can be manually changed or overridden.\u003c/p\u003e\n"],["\u003cp\u003eYou can check your current default region and zone settings by querying the metadata server using the \u003ccode\u003egcloud compute project-info describe\u003c/code\u003e command, which will list \u003ccode\u003egoogle-compute-default-region\u003c/code\u003e and \u003ccode\u003egoogle-compute-default-zone\u003c/code\u003e if they are set.\u003c/p\u003e\n"],["\u003cp\u003eThe default region and zone can be modified either through the Google Cloud console settings page, or by using the \u003ccode\u003egcloud compute project-info add-metadata\u003c/code\u003e command to update the metadata server, followed by the \u003ccode\u003egcloud init\u003c/code\u003e command to refresh the local configuration.\u003c/p\u003e\n"]]],[],null,["# Changing the default region or zone\n\n*** ** * ** ***\n\nThis page explains how to set a default\n[region or zone](/compute/docs/regions-zones) for your Google Cloud console\n[project](/resource-manager/docs/creating-managing-projects).\n\nWhen you make a request to Compute Engine, you might be required to\nprovide a region or a zone depending on the specific requirements of your\nrequest. Any request involving\n[regional](/compute/docs/regions-zones/global-regional-zonal-resources#regionalresources)\nresources requires that you supply a region name, and any request involving\n[zonal](/compute/docs/regions-zones/global-regional-zonal-resources#zoneresource)\nresources requires that you supply a zone name. For example, you must specify\na region when you create a static external IP address, and you must specify\na zone when you create a virtual machine (VM) instance.\n\nWhen you create a project, Compute Engine automatically selects\na default region and zone based on the location from which you create the\nproject. Compute Engine attempts to pick a region and a\nzone that are close to where the project originates so that resources you\ncreate have reduced latency to your customers or clients. If you want to\ncreate resources in a different region or zone, you can override the default\nselection.\n\nFor more information about regions and zones, see\n[Regions and zones](/compute/docs/regions-zones).\n\nFor more information about global, regional, and zonal Compute Engine\nresources, see\n[Global, regional, and zonal resources](/compute/docs/regions-zones/global-regional-zonal-resources).\n\nBefore you begin\n----------------\n\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\nHow a default region and zone affect your project\n-------------------------------------------------\n\nThe default region and zone settings affect only client tools, such as the\nGoogle Cloud CLI and the Google Cloud console. When you use these tools to\nconstruct your requests, the tools help you manage resources by automatically\nselecting the default region and zone.\n\nWhen you use the Google Cloud console to create regional or zonal resources\nlike addresses and instances, Compute Engine sets the region and zone\nfields for you. You can accept the pre-populated values or explicitly change\none or both of the values.\n\nWhen you use the gcloud CLI, omit setting the `--region` and\n`--zone` flags to use the default region and zone properties for the new\nproject.\n\nYou can always change the default region and zone settings in the metadata\nserver, override the default region and zone locally for the\ngcloud CLI, or override the settings manually for each request\nby using either the gcloud CLI or the Google Cloud console.\n\nLooking up the default region or zone\n-------------------------------------\n\nThe metadata server contains metadata information about a project, including\nthe project ID and project name. You can query the metadata server to get\nand use information about the project.\n\nIf you specify a default region and zone for your project, then\nCompute Engine sets these values in the\n[metadata server](/compute/docs/storing-retrieving-metadata) for your project.\n\nDefault regions and zones are set by using the following values:\n\n- `google-compute-default-region`\n- `google-compute-default-zone`\n\nTo see what your default region and zone settings are, run the following\n[`gcloud`](/compute/docs/gcloud-compute) command, replacing\n\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID: \n\n gcloud compute project-info describe --project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nLook for the default region and zone metadata values in the response. If the\n`google-compute-default-region` and `google-compute-default-zone`\nkeys and values are missing from the response, that means no default region\nor zone is set.\n\nChanging the default region or zone\n-----------------------------------\n\nThere are no restrictions on which regions or zones you can set for your default properties. For example, it is possible to set a default zone that is outside of your default region. Check the default region and zone settings when creating and managing your resources. \n\n### Console\n\nTo change your default region or zone, follow these steps:\n\n1. In the Google Cloud console, go to the **Settings** page.\n\n [Go to Settings](https://console.cloud.google.com/compute/settings)\n2. From the **Region** drop-down menu, select a default region.\n\n3. From the **Zone** drop-down menu, select a default zone.\n\n4. Click **Save**.\n\n### gcloud\n\nYou can change the default region and zone\nby making a request to the\n[metadata](/compute/docs/storing-retrieving-metadata) server. For example: \n\n```\ngcloud compute project-info add-metadata \\\n --metadata google-compute-default-region=europe-west1,google-compute-default-zone=europe-west1-b\n```\n\nAfter you update the default metadata by using any method, run the\n`gcloud init` command to reinitialize your `default` configuration.\nThe gcloud CLI refreshes the default region and zone settings\nonly after you run the `gcloud init` command.\n\nFor more information about using the gcloud CLI options to set default\nregions and zones, see\n[Set default properties](/compute/docs/gcloud-compute#default-properties).\n\nWhat's next\n-----------\n\n- Learn more about [regions and zones](/compute/docs/regions-zones).\n- Learn more about [global, regional, and zonal resources](/compute/docs/regions-zones/global-regional-zonal-resources)."]]