In diesem Abschnitt wird beschrieben, wie Sie die NAT-IP-Adressen für Apigee-Instanzen verwalten.
Apigee stellt sitzungsspezifische IP-Adressen und dedizierte IP-Adressen bereit. In vielen Fällen sind sitzungsspezifische IP-Adressen ausreichend.
Wenn für Ihr Back-End keine IP-Zulassungsliste erforderlich ist, müssen Sie keine NAT-IP-Adressen verwalten. Apigee weist dann für den ausgehenden Traffic automatisch sitzungsspezifische IP-Adressen zu.
Wenn Sie eine IP-Zulassungsliste benötigen, können Sie IP-Adressen reservieren und aktivieren, damit Apigee statische IP-Adressen für ausgehenden Traffic verwendet.
Bereitstellung von Apigee NAT-IP-Adressen einrichten
So legen Sie die NAT-IP-Bereitstellung für Ihre Apigee-Instanz fest:
Erstellen und füllen Sie die folgenden Umgebungsvariablen:
YOUR_PROJECT_ID ist die Cloud-Projekt-ID, die Sie im Rahmen der Voraussetzungen erstellt haben.
Wenn Sie die Projekt-ID nicht kennen, verwenden Sie die Cloud Console oder den Befehl gcloud projects list, um sie zu erfahren.
YOUR_ORG_ID ist die Apigee-Organisations-ID.
YOUR_INSTANCE_NAME ist der Name Ihrer Apigee-Instanz.
1st_NAT_IP_ID ist der Name, den Sie dieser NAT-IP-Adresse zuweisen, z. B. nat-1. Der Wert dieses Parameters darf maximal 20 Zeichen lang sein.
Reservieren Sie mit den folgenden Befehlen eine NAT-IP-Adresse:
Rufen Sie in der Befehlszeile Ihre gcloud-Authentifizierungsdaten ab, wie im folgenden Beispiel gezeigt:
TOKEN=$(gcloud auth print-access-token)
Um zu prüfen, ob Ihr Token ausgefüllt wurde, verwenden Sie echo wie im folgenden Beispiel:
echo $TOKEN
Das Token sollte als codierter String angezeigt werden.
Der Befehl zum Reservieren der NAP-IP-Adresse gibt den lang andauernden Vorgang zurück. Mit dem hier gezeigten Befehl wird also die Ausgabe der Variablen operation_name zugewiesen:
CREATING : Die NAT-IP-Erstellung steht aus. Noch nicht bereit.
RESERVED: Die NAT-IP-Adresse wurde erstellt, aber nicht verwendet. Dadurch haben Sie die Möglichkeit, diese IP-Adresse in die Zulassungsliste aufzunehmen, bevor Sie sie aktivieren.
ACTIVE: Die NAT-IP-Adresse wird verwendet, um ausgehenden Traffic zu senden.
DELETING: Die NAT-IP-Adresse wird gelöscht.
NAT-IP-Adressen löschen
Sie können NAT-IP-Adressen mit dem folgenden Befehl löschen.
Löschen Sie die IP-Adresse und weisen Sie die Ausgabe „operation_name“ zu.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (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 ```"]]