Bagian ini menjelaskan cara mengelola IP NAT untuk instance Apigee.
Apigee menyediakan IP sementara dan IP khusus. Dalam banyak kasus, IP sementara sudah cukup.
Jika backend Anda tidak memerlukan daftar IP yang diizinkan, Anda tidak perlu mengelola IP NAT, dan Apigee
akan otomatis mengalokasikan IP sementara untuk keluar.
Jika memerlukan daftar yang diizinkan IP, Anda dapat mencadangkan dan mengaktifkan IP sehingga Apigee menggunakan IP statis untuk traffic keluar.
Menyiapkan penyediaan IP NAT Apigee
Untuk menyetel penyediaan IP NAT untuk instance Apigee Anda:
YOUR_PROJECT_ID adalah project ID Cloud yang Anda buat sebagai bagian dari
Prasyarat.
Jika Anda tidak yakin dengan project ID Anda, gunakan konsol Cloud atau
perintah gcloud projects list untuk menemukannya.
YOUR_ORG_ID adalah ID organisasi Apigee Anda.
YOUR_INSTANCE_NAME adalah nama instance Apigee Anda.
1st_NAT_IP_ID adalah nama yang Anda tetapkan ke alamat IP NAT ini; misalnya, nat-1. Nilai parameter ini tidak boleh lebih dari 20 karakter.
Cadangkan IP NAT dengan perintah berikut:
Di command line, dapatkan kredensial autentikasi gcloud, seperti yang ditunjukkan dalam contoh berikut:
TOKEN=$(gcloud auth print-access-token)
Untuk memeriksa apakah token Anda terisi, gunakan echo, seperti yang ditunjukkan contoh berikut:
echo $TOKEN
Token Anda akan ditampilkan sebagai string yang dienkode.
Perintah untuk mencadangkan IP NAT menampilkan operasi yang berjalan lama. Oleh karena itu, perintah
seperti yang ditunjukkan di sini menetapkan output ke variabel operation_name:
CREATING : Pembuatan IP NAT sedang menunggu keputusan. Belum siap digunakan.
RESERVED: IP NAT telah dibuat tetapi tidak digunakan. Dengan demikian, Anda berpeluang untuk memasukkan IP ini ke daftar yang diizinkan sebelum mengaktifkannya.
ACTIVE: IP NAT digunakan untuk mengirim traffic keluar.
DELETING: IP NAT sedang dihapus.
Menghapus IP NAT
Anda dapat menghapus IP NAT dengan perintah berikut:
[[["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-21 UTC."],[[["\u003cp\u003eThis guide focuses on managing NAT IPs for Apigee, excluding Apigee hybrid, and directing users to the Apigee Edge documentation for further information.\u003c/p\u003e\n"],["\u003cp\u003eApigee uses ephemeral IPs by default, automatically managing them for egress traffic unless IP allow-listing is required.\u003c/p\u003e\n"],["\u003cp\u003eTo use static IPs for egress, users can reserve and activate dedicated NAT IPs by creating and populating specific environment variables like \u003ccode\u003ePROJECT_ID\u003c/code\u003e, \u003ccode\u003eORG_ID\u003c/code\u003e, \u003ccode\u003eINSTANCE_NAME\u003c/code\u003e, and \u003ccode\u003eNAT_ID\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eReserving and activating NAT IPs involve using \u003ccode\u003egcloud\u003c/code\u003e authentication credentials and running commands to create and activate them, which requires polling long-running operations to confirm completion.\u003c/p\u003e\n"],["\u003cp\u003eUsers can manage the lifecycle of NAT IPs, with states including \u003ccode\u003eCREATING\u003c/code\u003e, \u003ccode\u003eRESERVED\u003c/code\u003e, \u003ccode\u003eACTIVE\u003c/code\u003e, and \u003ccode\u003eDELETING\u003c/code\u003e, and list or delete them using provided commands.\u003c/p\u003e\n"]]],[],null,["# Provisioning NAT IPs\n\n*This page\napplies to **Apigee** , but not to **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\nThis section describes how to manage the NAT IPs for Apigee instances.\n\nApigee provides ephemeral IPs and dedicated IPs. In many cases, ephemeral IPs are sufficient.\nIf your backend doesn't require IP allow-listing, you will not need to manage NAT IPs, and Apigee\nwill automatically allocate ephemeral IPs for egress.\n\nIf you require IP allow-listing, you can reserve and activate IPs so that Apigee uses static IPs\nfor egress traffic.\n\nSet up Apigee NAT IP provisioning\n---------------------------------\n\n**To set NAT IP provisioning for your Apigee instance:**\n\n1. Create and populate the following environment variables:\n\n ### Variables\n\n PROJECT_ID=YOUR_PROJECT_ID\n ORG_ID=\u003cvar translate=\"no\"\u003eYOUR_ORG_ID\u003c/var\u003e\n INSTANCE_NAME=\u003cvar translate=\"no\"\u003eYOUR_INSTANCE_NAME\u003c/var\u003e\n NAT_ID=\u003cvar translate=\"no\"\u003e1st_NAT_IP_ID\u003c/var\u003e\n\n ### Example\n\n PROJECT_ID=apigee-saas-prod\n ORG_ID=apigee-saas-prod\n INSTANCE_NAME=prod-us-west1-instance1\n NAT_ID=nat-1\n\n Where:\n - \u003cvar translate=\"no\"\u003eYOUR_PROJECT_ID\u003c/var\u003e is the Cloud project ID that you created as part of the [Prerequisites](/apigee/docs/api-platform/get-started/overview#prerequisites). If you're not sure what your project ID is, use Cloud console or the `gcloud projects list` command to find it.\n - \u003cvar translate=\"no\"\u003eYOUR_ORG_ID\u003c/var\u003e is your Apigee organization ID.\n - \u003cvar translate=\"no\"\u003eYOUR_INSTANCE_NAME\u003c/var\u003e is the name of your Apigee instance.\n - \u003cvar translate=\"no\"\u003e1st_NAT_IP_ID\u003c/var\u003e is the name you are assigning to this NAT IP address; for example, `nat-1`. The value of this parameter must not exceed 20 characters.\n2. Reserve a NAT IP with the following commands: **Note:** These commands can take several minutes to execute.\n 1. On the command line, get your `gcloud` authentication credentials, as the following example shows:\n\n ```\n TOKEN=$(gcloud auth print-access-token)\n ```\n\n To check that your token was populated, use `echo`, as the following example shows: \n\n ```\n echo $TOKEN\n ```\n\n This should display your token as an encoded string.\n\n For more information, see\n [gcloud command-line tool overview](https://cloud.google.com/sdk/gcloud/).\n 2. The command to reserve the NAT IP returns the long-running operation. Therefore the command as shown here assigns the output to a variable `operation_name`: \n\n ```\n operation_name=$(curl -H \"Authorization: Bearer $TOKEN\" \\\n \"https://apigee.googleapis.com/v1/organizations/${ORG_ID}/instances/${INSTANCE_NAME}/natAddresses\" \\\n -X POST -H \"content-type:application/json\" -d \"{\\\"name\\\":\\\"${NAT_ID}\\\"}\" | jq -r '.name')\n ```\n 3. Poll the long-running operation until it shows a status of `done: true` by executing the following request: \n\n ```\n curl -s -H \"Authorization: Bearer $TOKEN\" \"https://apigee.googleapis.com/v1/$operation_name\"\n ```\n3. After the operation is completed, activate the NAT IP with the following commands: **Note:** These commands can take several minutes to execute.\n 1. Activate the IP and assign the long-running operation name to `operation_name`: \n\n ```\n operation_name=$(curl -H \"Authorization: Bearer $TOKEN\" \\\n \"https://apigee.googleapis.com/v1/organizations/${ORG_ID}/instances/${INSTANCE_NAME}/natAddresses/${NAT_ID}:activate\" \\\n -X POST -H \"content-type:application/json\" -d \"{}\" | jq -r '.name')\n ```\n 2. Poll the long-running operation until it shows a status of `done: true`: \n\n ```\n curl -s -H \"Authorization: Bearer $TOKEN\" \"https://apigee.googleapis.com/v1/$operation_name\"\n ```\n4. Repeat this procedure with a new NAT IP name for each NAT IP you neet to set up.\n\nFetching NAT IPs\n----------------\n\nList the NAT IPs for an instance with the following command: \n\n```\ncurl -H \"Authorization: Bearer $TOKEN\" \\\n \"https://apigee.googleapis.com/v1/organizations/${ORG_ID}/instances/${INSTANCE_NAME}/natAddresses\"\n```\n\nAn example response would look like: \n\n```\n{\n \"natAddresses\": [\n {\n \"name\": \"nat-1\",\n \"ipAddress\": \"35.203.160.18\",\n \"state\": \"ACTIVE\"\n },\n {\n \"name\": \"nat-2\",\n \"ipAddress\": \"35.230.14.174\",\n \"state\": \"RESERVED\"\n },\n {\n \"name\": \"nat-3\",\n \"state\": \"CREATING\"\n }\n ]\n}\n```\n\n### States of a NAT IP\n\n- `CREATING `: The NAT IP creation is pending. Not ready to be used.\n- `RESERVED`: The NAT IP has been created but not used. This gives you the opportunity to allow-list this IP before activating it.\n- `ACTIVE`: The NAT IP is being used to send egress traffic.\n- `DELETING`: The NAT IP is being deleted.\n\nDeleting NAT IPs\n----------------\n\nYou can delete NAT IPs with the following command:\n\n1. Delete the IP and assign the output to \"`operation_name`.\" \n\n ```\n operation_name=$(curl -H \"Authorization: Bearer $TOKEN\" \\\n \"https://apigee.googleapis.com/v1/organizations/${ORG_ID}/instances/${INSTANCE_NAME}/natAddresses/${NAT_ID}\" \\\n -X DELETE | jq -r '.name')\n ```\n2. Poll the long-running operation until it shows a status of `done: true`. \n\n ```\n curl -s -H \"Authorization: Bearer $TOKEN\" \"https://apigee.googleapis.com/v1/$operation_name\"\n ```"]]