Ir para o conteúdo
NimbusNexus

IPs flutuantes

Um IP flutuante é um endereço IP público que pertence ao seu projeto, não a uma VM específica. Você reserva um em uma rede externa, aloca-o a uma porta de uma VM, e ele se torna o IP público dessa VM. Mais tarde, desanexe-o e anexe-o a outra VM — seu tráfego passa a ir para a nova VM, sem que o endereço mude.

Por que os IPs flutuantes existem

O IP padrão que uma VM recebe é efêmero — destruir a VM devolve o IP ao pool, e uma VM recriada recebe um novo. Isso funciona bem para workers sem estado atrás de um balanceador de carga. É péssimo para:

  • Qualquer coisa endereçada por registro DNS A/AAAA (o registro quebra toda vez que a VM é recriada)
  • Qualquer coisa na allow-list de IPs de um parceiro (o parceiro precisa incluir o IP na allow-list de novo)
  • Deploys blue/green em que você quer mover o tráfego entre duas VMs já aquecidas sem propagação de DNS

Um IP flutuante resolve os três casos. O IP sobrevive a qualquer VM específica; você o move de uma VM para outra com uma única chamada de API.

Escopo de região

Os IPs flutuantes têm escopo de região. Um IP vem da rede externa de uma região e só é anexado a portas dessa região.

Faturamento

Um IP flutuante é cobrado pelo seu próprio preço desde o momento em que é criado até ser excluído, esteja anexado ou não. Anexá-lo a uma VM não o inclui no custo da VM. O preço atual está em Dados de preços.

O padrão comum: crie o IP quando precisar, anexe-o imediatamente e exclua-o quando terminar.

IPv4 vs. IPv6

Não existe um campo de versão: um endereço vem da rede externa que você indica em floating_network_id, e POST /api/v1/floating_ip/reserve também pode receber um ip_address específico. GET /api/v1/floating_ip/artifacts lista as redes externas com o ip_version de cada sub-rede.

Cada IP flutuante se vincula a um IP fixo em uma porta (vm_port_id e vm_ip_address), então uma VM com vários IPs fixos pode ter um IP flutuante em cada um.

Semântica de anexar / desanexar

  • Anexar é POST /api/v1/floating_ip/allocate, com a rede externa (floating_network_id), a porta (vm_port_id) e o IP fixo dela (vm_ip_address). Passe floating_ip_id para anexar um endereço que você já tem; sem ele, allocate cria um novo. GET /api/v1/floating_ip/artifacts?resource_id=<id> lista as portas de uma VM ou de um balanceador de carga.
  • Desanexar é POST /api/v1/floating_ip/deallocate. Isso não libera o IP; só o desvincula da VM. O IP continua sendo cobrado até você excluí-lo, com DELETE /api/v1/floating_ip/ (o id dele em ids) ou com deallocate e delete: true.
  • Anexar o mesmo IP a outra VM: esse é exatamente o caminho de failover. Desanexe, anexe ao novo destino, e o DNS não muda.

Próximos passos

  • Máquinas virtuais — o recurso ao qual os IPs flutuantes são anexados.
  • Regiões — os IPs flutuantes têm escopo de região.

Reference

GET/api/v1/floating_ip/

Floating Ips List

Lists floating IPs visible to the project, resolving the attached compute, router, or load balancer.

Parameters

NameInTypeDescription
admin_domainquerystring | null—
admin_projectquerystring | null—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/floating_ip/" \
  -H "Authorization: Bearer $NIMBUS_KEY"
DELETE/api/v1/floating_ip/

Delete Ips

Deletes a batch of floating IPs by their IDs.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
ids*array of string—

Responses

  • 204Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X DELETE "https://api.nimbusnexus.net/api/v1/floating_ip/" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "example"
    ]
  }'
POST/api/v1/floating_ip/allocate

Allocate Ip

Allocates a floating IP to a port, attaching a bandwidth-billed QoS policy and creating the billing order.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
floating_network_id*string—
vm_port_id*string—
vm_ip_address*string—
floating_ip_idstring | null—
bandwidth_subscriptionPlanType | null—
bandwidth_mbpsinteger | null—
product_categorystringProduct category for billing
subscriptionobjectSubscription plan type

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/floating_ip/allocate" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "floating_network_id": "<floating_network_id>",
    "vm_port_id": "<vm_port_id>",
    "vm_ip_address": "example"
  }'
GET/api/v1/floating_ip/artifacts

Floating Ip Artifacts

Returns reservable floating IPs, external networks, and the target resource's interfaces for floating-IP allocation.

Parameters

NameInTypeDescription
admin_domainquerystring | null—
admin_projectquerystring | null—
resource_idquerystring | null—
product_type_namequerystring—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/floating_ip/artifacts" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/floating_ip/deallocate

Deallocate Ip

Detaches a floating IP from its port, optionally deleting the floating IP entirely.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
id*string—
deleteboolean—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/floating_ip/deallocate" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "example"
  }'
POST/api/v1/floating_ip/reserve

Reserve Ip

Reserves a floating IP on an external network without binding it to any port.

Request body

FieldTypeDescription
admin_domainstring | null—
admin_projectstring | null—
floating_network_id*string—
ip_addressstring | null—
descriptionstring | null—

Responses

  • 201Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 409Conflict
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/floating_ip/reserve" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "floating_network_id": "<floating_network_id>"
  }'

Need to make a real call? Try these endpoints in the live Swagger UI →