En esta sección, se describe cómo administrar las IP con NAT para las instancias de Apigee.
Apigee proporciona IP efímeras e IP dedicadas. En muchas instancias, las IP efímeras son suficientes.
Si el backend no requiere una lista de IP de permiso, no deberás administrar IP NAT, y Apigee asignará IP efímeras automáticamente para la salida.
Si necesitas la lista de permisos IP, puedes reservar y activar IP a fin de que Apigee use IP estáticas para el tráfico de salida.
Configura el aprovisionamiento de IP de NAT de Apigee
A fin de configurar el aprovisionamiento de IP de NAT para tu instancia de Apigee, sigue estos pasos:
Crea y propaga las siguientes variables de entorno:
YOUR_PROJECT_ID es el ID del proyecto de Cloud que creaste como parte de los
requisitos previos.
Si no estás seguro de cuál es tu ID del proyecto, usa la consola de Cloud o el comando gcloud projects list para encontrarlo.
YOUR_ORG_ID es el ID de tu organización de Apigee.
YOUR_INSTANCE_NAME es el nombre de tu instancia de Apigee.
1st_NAT_IP_ID es el nombre que asignas a esta dirección IP de NAT, por ejemplo: nat-1. El valor de este parámetro no debe superar los 20 caracteres.
Reserva una IP de NAT con los siguientes comandos:
En la línea de comandos, obtén tus credenciales de autenticación de gcloud, como se muestra en el siguiente ejemplo:
TOKEN=$(gcloud auth print-access-token)
Para verificar que tu token se haya propagado, usa echo, como se muestra en el siguiente ejemplo:
echo $TOKEN
Se debería mostrar tu token como una string codificada.
El comando para reservar la IP de NAT muestra la operación de larga duración. Por lo tanto, el
comando como se muestra aquí asigna el resultado a una variable operation_name:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (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 ```"]]