Aller au contenu
NimbusNexus

IP flottantes

Une IP flottante est une adresse IP publique qui appartient à votre projet, pas à une VM précise. Vous en réservez une sur un réseau externe, vous l’allouez à un port d’une VM, et elle devient l’IP publique de cette VM. Détachez-la plus tard et rattachez-la à une autre VM — votre trafic va désormais vers la nouvelle VM, sans que l’adresse change.

Pourquoi les IP flottantes existent

L’IP attribuée par défaut à une VM est éphémère — détruire la VM rend l’IP au pool, et une VM recréée en reçoit une nouvelle. Cela convient aux workers sans état placés derrière un load balancer. C’est désastreux pour :

  • Tout ce qui est adressé par un enregistrement DNS A/AAAA (l’enregistrement casse à chaque recréation de la VM)
  • Tout ce qui figure dans la liste d’autorisation d’IP d’un partenaire (le partenaire doit autoriser la nouvelle adresse)
  • Les déploiements blue/green, où vous voulez basculer le trafic entre deux VM déjà démarrées sans attendre la propagation DNS

Une IP flottante règle ces trois cas. L’IP survit à n’importe quelle VM ; vous la basculez d’une VM à l’autre avec un seul appel d’API.

Portée régionale

Les IP flottantes sont propres à une région. Une IP provient du réseau externe d’une région et ne s’attache qu’à des ports de cette région.

Facturation

Une IP flottante est facturée à son propre prix, de sa création à sa suppression, qu’elle soit attachée ou non. L’attacher à une VM ne l’intègre pas au coût de la VM. Données tarifaires indique le prix actuel.

Le schéma habituel : créez l’IP quand vous en avez besoin, attachez-la aussitôt, et supprimez-la quand vous avez terminé.

IPv4 ou IPv6

Il n’y a pas de champ de version : une adresse provient du réseau externe que vous indiquez dans floating_network_id, et POST /api/v1/floating_ip/reserve peut aussi prendre une ip_address précise. GET /api/v1/floating_ip/artifacts liste les réseaux externes avec l’ip_version de chaque sous-réseau.

Chaque IP flottante se lie à une IP fixe sur un port (vm_port_id et vm_ip_address) : une VM qui a plusieurs IP fixes peut donc porter une IP flottante sur chacune.

Sémantique d’attachement et de détachement

  • L’attachement passe par POST /api/v1/floating_ip/allocate, avec le réseau externe (floating_network_id), le port (vm_port_id) et son IP fixe (vm_ip_address). Passez floating_ip_id pour attacher une adresse que vous avez déjà ; sans lui, allocate en crée une nouvelle. GET /api/v1/floating_ip/artifacts?resource_id=<id> liste les ports d’une VM ou d’un load balancer.
  • Le détachement passe par POST /api/v1/floating_ip/deallocate. Il ne libère pas l’IP ; il la dissocie seulement de la VM. L’IP reste facturée jusqu’à ce que vous la supprimiez, avec DELETE /api/v1/floating_ip/ (son identifiant dans ids) ou avec deallocate et delete: true.
  • Rattacher la même IP à une autre VM : c’est exactement le chemin du basculement. Détachez, attachez à la nouvelle cible, le DNS ne change pas.

Étapes suivantes

  • Machines virtuelles — la ressource à laquelle s’attachent les IP flottantes.
  • Régions — les IP flottantes sont propres à une région.

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 →