Esta seção descreve como gerenciar os IPs NAT para instâncias da Apigee.
A Apigee fornece IPs efêmeros e IPs dedicados. Em muitos casos, IPs temporários são suficientes.
Se o back-end não exigir a listagem de permissões de IP, você não precisará gerenciar IPs NAT, e a Apigee
alocará automaticamente IPs temporários para saída.
Se você precisar de uma lista de permissões de IP, poderá reservar e ativar IPs para que a Apigee use IPs estáticos para o tráfego de saída.
Configurar o provisionamento de IP NAT da Apigee
Para definir o provisionamento de IP NAT para sua instância do Apigee:
Crie e preencha as seguintes variáveis de ambiente:
YOUR_PROJECT_ID é o ID do projeto do Cloud que você criou como parte dos
pré-requisitos.
Se você não tiver certeza de qual é o ID do projeto, use o Console do Cloud ou
o comando gcloud projects list para encontrá-lo.
YOUR_ORG_ID é o ID da organização da Apigee
YOUR_INSTANCE_NAME é o nome da instância da Apigee.
1st_NAT_IP_ID é o nome que você está atribuindo a esse endereço IP NAT, por exemplo:
nat-1. O valor desse parâmetro não pode exceder 20 caracteres.
Reserve um IP NAT com os seguintes comandos:
Na linha de comando, receba as credenciais de autenticação de gcloud. Veja o exemplo a seguir:
TOKEN=$(gcloud auth print-access-token)
Para verificar se o token foi preenchido, use echo, como mostra o exemplo a seguir:
echo $TOKEN
Isso exibirá seu token como uma string codificada.
O comando para reservar o IP NAT retorna a operação de longa duração. Portanto, o comando como mostrado aqui atribui a saída a uma variável operation_name:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-07 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 ```"]]