Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menampilkan konfigurasi yang diperlukan untuk mengekspos service lingkungan fleksibel App Engine hanya pada alamat IP internalnya.
Secara default, service lingkungan fleksibel menerima alamat IP internal dan alamat IP eksternal sementara saat pertama kali di-deploy. Alamat IP eksternal sementara memungkinkan service Anda mengirim permintaan ke
service App Engine dengan domain kustom dan resource di internet.
Alamat IP eksternal sementara akan dikenai biaya.
Jika service Anda tidak memerlukan
alamat IP eksternal, Anda dapat mencegah
service mengirimkan permintaan ke resource di internet dan mengurangi biaya dengan
membatasi service agar hanya menggunakan alamat IP internalnya. Hal ini tidak
mencegah service Anda menerima permintaan dari internet atau
service App Engine dengan domain kustom, karena nama domain yang sepenuhnya memenuhi syarat pada service Anda masih terlihat secara eksternal.
Batasan
Penonaktifan alamat IP eksternal sementara memiliki batasan berikut:
Service dengan domain kustom: Untuk mengirim permintaan ke service App Engine dengan domain kustom, Anda harus mengonfigurasi Cloud NAT.
Resource eksternal: Untuk mengirim permintaan ke resource eksternal, Anda harus mengonfigurasi Cloud NAT.
Dependensi Akses Google Pribadi: Instance dengan mode IP yang disetel ke internal memerlukan Akses Google Pribadi pada subnetwork target.
Jaringan lama:Jaringan lama tidak dapat menggunakan Akses Google Pribadi sehingga tidak dapat menonaktifkan alamat IP eksternal sementara.
Sebelum memulai
Untuk men-deploy aplikasi lingkungan fleksibel tanpa alamat IP eksternal, Anda harus
mengaktifkan Akses Google Pribadi pada subnetwork target.
Untuk mempelajari Akses Google Pribadi, lihat Ringkasan.
Jika Anda menggunakan VPC Bersama, ikuti langkah-langkah berikut untuk menyiapkan
jaringan VPC Bersama untuk konfigurasi lebih lanjut.
Pastikan Anda memiliki rute yang kompatibel dengan
Akses Google Pribadi. Biasanya,
rute default jaringan kompatibel dengan Akses Google Pribadi. Untuk rute lainnya, pastikan
rute telah dikonfigurasi sebagai berikut.
Network: SHARED_VPC_NETWORK_NAME
Destination IP address range: 0.0.0.0/0
Instance tags: INSTANCE_TAGS
Next hop: DEFAULT_INTERNET_GATEWAY
Ganti kode berikut:
SHARED_VPC_NETWORK_NAME: Nama jaringan VPC Bersama Anda.
INSTANCE_TAGS: Jika Anda tidak menggunakan tag instance apa pun, jangan tentukan apa pun di kolom ini. Jika Anda menggunakan tag instance, sertakan aef-instances dalam daftar tag instance.
DEFAULT_INTERNET_GATEWAY: Gateway internet default.
Guna mempelajari lebih lanjut rute yang kompatibel untuk Akses Google Pribadi, lihat
dokumentasi Akses Google Pribadi tentang
opsi pemilihan rute.
Pastikan Anda memiliki aturan firewall yang kompatibel dengan
Akses Google Pribadi. Aturan firewall harus dikonfigurasi sebagai berikut.
Network: SHARED_VPC_NETWORK_NAME
Destination IP address range: 0.0.0.0/0
Destination filter: IP ranges
Direction of traffic: Egress
Attach on match: Allow
Instance tags: INSTANCE_TAGS
Ganti kode berikut:
SHARED_VPC_NETWORK_NAME: Nama jaringan VPC Bersama Anda.
INSTANCE_TAGS: Jika Anda tidak menggunakan tag instance apa pun, jangan tentukan apa pun di kolom ini. Jika Anda menggunakan tag instance, sertakan aef-instances dalam daftar tag instance.
Untuk mempelajari lebih lanjut aturan firewall yang kompatibel bagi Akses Google Pribadi, lihat dokumentasi Akses Google Pribadi tentang konfigurasi firewall.
Mengonfigurasi service Anda agar hanya menggunakan alamat IP internalnya
Mengupdate Google Cloud CLI. Hal ini memastikan bahwa Anda menggunakan versi gcloud CLI yang mendukung alamat IP pribadi untuk aplikasi lingkungan fleksibel.
gcloudcomponentsupdate
Dalam file app.yaml, tambahkan kolom instance_ip_mode ke
bagian network
dan tetapkan ke internal.
Jika file app.yaml Anda sudah memiliki bagian network, tambahkan baris
berikut di dalam bagian network:
instance_ip_mode:internal
Jika file app.yaml Anda tidak memiliki bagian network, buat
bagian ini dan tentukan mode IP instance dengan menambahkan baris berikut:
network:
instance_ip_mode:internal
Simpan perubahan ini.
Men-deploy service.
gcloudbetaappdeploy
Verifikasi konfigurasi dengan memeriksa halaman Instance di konsol Google Cloud .
Scroll ke bawah menuju tabel Instances (di bawah chart Ringkasan). Di kolom
IP Eksternal, konfirmasi bahwa tidak ada alamat IP yang tercantum. Karena alamat IP tidak tersedia di kolom ini, instance Anda tidak memiliki alamat IP eksternal. Meskipun kolom ini kosong, instance Anda masih memiliki alamat IP internal.
Mengirim permintaan eksternal tanpa alamat IP eksternal
Jika service Anda mengirim permintaan ke internet, tetapi Anda ingin membatasinya agar hanya menggunakan alamat IP internalnya, Anda dapat menggunakan Cloud NAT untuk membuat gateway. Service Anda dapat mengirim permintaan eksternal melalui gateway Cloud NAT tanpa menggunakan alamat IP eksternal sementara 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 guide outlines how to configure an App Engine flexible environment service to use only its internal IP address, thus preventing it from sending requests to resources on the internet and reducing costs associated with ephemeral external IP addresses.\u003c/p\u003e\n"],["\u003cp\u003eDisabling ephemeral external IP addresses requires enabling Private Google Access on the target subnetwork and has limitations, including the necessity to configure Cloud NAT for services with custom domains or those sending requests to external resources.\u003c/p\u003e\n"],["\u003cp\u003eTo prepare a Shared VPC network, it's essential to verify compatibility with Private Google Access by confirming the presence of a compatible default route and a firewall rule configured for egress traffic.\u003c/p\u003e\n"],["\u003cp\u003eConfiguring the service involves updating the Google Cloud CLI, adding the \u003ccode\u003einstance_ip_mode: internal\u003c/code\u003e line in the \u003ccode\u003enetwork\u003c/code\u003e section of the \u003ccode\u003eapp.yaml\u003c/code\u003e file, deploying the updated service, and verifying the absence of an external IP address on the Instances page in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eServices limited to internal IPs needing to send requests to the internet can do so via setting up a Cloud NAT gateway, which acts as an intermediary allowing communication without the service utilizing an ephemeral external IP.\u003c/p\u003e\n"]]],[],null,["# Configure private internal-only services\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page shows the required configuration for exposing an App Engine flexible environment\nservice only on its internal IP address.\n\nBy default, flexible environment services receive both an internal IP address\nand an ephemeral external IP address when they are first deployed. The\nephemeral external IP address allows your service to send requests to\nApp Engine services with custom domains, and resources on the internet.\nEphemeral external IP addresses incur [costs](/vpc/network-pricing#ipaddress).\n\nIf your service does not require an external IP address, you can prevent your\nservice from sending requests to resources on the internet and reduce costs by\nlimiting your service to using only its internal IP address. This does not\nprevent your service from receiving requests from the internet or\nApp Engine services with custom domains, because the fully qualified\ndomain name of your service is still externally visible.\n\nLimitations\n-----------\n\nDisabling ephemeral external IP addresses has the following limitations:\n\n- **Services with custom domains:** To send requests to App Engine services with custom domains you must [configure Cloud NAT](/nat/docs/set-up-manage-network-address-translation).\n- **External resources:** To send requests to external resources you must [configure Cloud NAT](/nat/docs/set-up-manage-network-address-translation).\n- **Private Google Access dependency:** Instances with IP mode set to `internal` require [Private Google Access](/vpc/docs/private-google-access#pga-supported) on the target subnetwork.\n- **Legacy networks:** [Legacy networks](/vpc/docs/legacy) cannot use Private Google Access, and thus cannot disable ephemeral external IP addresses.\n\nBefore you begin\n----------------\n\nTo deploy flexible environment apps without external IP addresses, you must\nenable Private Google Access on the target subnetwork.\n\n- To learn about Private Google Access, see the [Overview](/vpc/docs/private-google-access#pga-supported).\n- For step-by-step configuration instructions, see [Enabling Private Google Access](/vpc/docs/configure-private-google-access#enabling-pga).\n\n### Prepare your Shared VPC network\n\nIf you use Shared VPC, follow these steps to prepare your\nShared VPC network for further configuration.\n\n1. Verify that you have a route that is compatible with\n Private Google Access. Typically the\n [default route](/vpc/docs/routes#routingpacketsinternet) of a network is\n compatible with Private Google Access. For other routes, confirm that\n the route is configured as follows.\n\n ```sh\n Network: SHARED_VPC_NETWORK_NAME\n Destination IP address range: 0.0.0.0/0\n Instance tags: INSTANCE_TAGS\n Next hop: DEFAULT_INTERNET_GATEWAY\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSHARED_VPC_NETWORK_NAME\u003c/var\u003e: The name of your Shared VPC network.\n - \u003cvar translate=\"no\"\u003eINSTANCE_TAGS\u003c/var\u003e: If you do not use any instance tags, do not specify anything in this field. If you do use instance tags, include `aef-instances` in your list of instance tags.\n - \u003cvar translate=\"no\"\u003eDEFAULT_INTERNET_GATEWAY\u003c/var\u003e: The default internet gateway.\n\n To learn more about compatible routes for Private Google Access, see\n the Private Google Access documentation on\n [routing options](/vpc/docs/configure-private-google-access#config-routing).\n2. Verify that you have a firewall rule that is compatible with\n Private Google Access. The firewall rule must be configured as\n follows.\n\n ```sh\n Network: SHARED_VPC_NETWORK_NAME\n Destination IP address range: 0.0.0.0/0\n Destination filter: IP ranges\n Direction of traffic: Egress\n Attach on match: Allow\n Instance tags: INSTANCE_TAGS\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSHARED_VPC_NETWORK_NAME\u003c/var\u003e: The name of your Shared VPC network.\n - \u003cvar translate=\"no\"\u003eINSTANCE_TAGS\u003c/var\u003e: If you do not use any instance tags, do not specify anything in this field. If you do use instance tags, include `aef-instances` in your list of instance tags.\n\n To learn more about compatible firewall rules for\n Private Google Access, see the Private Google Access\n documentation on\n [firewall configuration](/vpc/docs/configure-private-google-access#config-firewall).\n\nConfigure your service to use only its internal IP address\n----------------------------------------------------------\n\n1. Update the Google Cloud CLI. This ensures that you are using a version of the\n gcloud CLI that supports private IP addresses for\n flexible environment apps.\n\n ```bash\n gcloud components update\n ```\n2. In your `app.yaml` file, add the `instance_ip_mode` field to the\n [`network` section](/appengine/docs/flexible/reference/app-yaml#network_settings)\n and set it to `internal`.\n\n - If your `app.yaml` file already has a `network` section, add the following\n line inside the `network` section:\n\n ```bash\n instance_ip_mode: internal\n ```\n\n \u003cbr /\u003e\n\n - If your `app.yaml` file doesn't have a `network` section, create the\n section and specify the instance IP mode by adding the following lines:\n\n ```bash\n network:\n instance_ip_mode: internal\n ```\n\n \u003cbr /\u003e\n\n Save these changes.\n3. Deploy the service.\n\n ```bash\n gcloud beta app deploy\n ```\n4. Verify configuration by checking the Instances page of the Google Cloud console.\n\n [Go to Instances](https://console.cloud.google.com/appengine/instances)\n\n Scroll down to the **Instances** table (below the **Summary** chart). In the\n **External IP** column, confirm that there is no IP address listed. The\n absence of an IP address in this column means that your instance has no\n external IP address. Even though this field is empty, your instance still has\n an internal IP address.\n\nSend external requests without an external IP address\n-----------------------------------------------------\n\nIf your service sends requests to the internet but you want to limit it to using\nonly its internal IP address, you can use [Cloud NAT](/nat/docs/overview) to\ncreate a gateway. Your service can send external requests through the\nCloud NAT gateway without using the default ephemeral external IP addresses.\n\n1. Follow the steps in the section\n [Configure your service to use only its internal IP address](#limit-to-internal).\n\n2. Follow the steps to\n [Configure Cloud NAT](/nat/docs/set-up-manage-network-address-translation).\n\nTo learn more about this approach, see the Cloud Architecture Center\ndocumentation on\n[Deploying Cloud NAT for fetching](/architecture/building-internet-connectivity-for-private-vms#deploying_cloud_nat_for_fetching)."]]