On this page
Floating IPs
A floating IP is a public address you can attach to an instance to make it reachable from the internet, and move to another instance whenever you need to.
Instances live on private networks and, by default, cannot be reached inbound from the internet. A floating IP is a public address your project holds; associating it with an instance forwards inbound traffic through your router's external gateway to that instance's fixed IP.
Because the public address is decoupled from any one instance, you can move it. Rebuild a server, promote a standby, or swap to a new version, and simply move the floating IP so the public address stays the same while what sits behind it changes.
Key concepts
Floating IP — A public address your project owns, independent of any single instance.
Association — The current mapping of a floating IP to an instance's fixed IP.
Allocation — Reserving a floating IP into your project from the external network pool.
Before you start
- A router with an external gateway serving the instance's subnet.
- A security group that allows the inbound ports you want to expose.
- Available floating IP quota in the project.
Step by step
- Open Floating IPs
Go to Networking and open Floating IPs.
Screenshot — The Floating IPs list with the Allocate buttonThe Floating IPs list with the Allocate button - Allocate an address
Allocate a new floating IP to your project from the external network.
Screenshot — The allocate dialogThe allocate dialog - Associate it
Associate the floating IP with the instance you want to expose.
Screenshot — The associate-to-instance dialogThe associate-to-instance dialog - Confirm reachability
- Check that a security group on the instance allows the port you exposed.
- Test the connection to the floating IP from outside.
- Move or release
Disassociate and reassociate the address to move it, or release it back to the pool when you no longer need it.
Examples
patrii floating-ip create --network public patrii floating-ip attach web-1 --ip 203.0.113.42
patrii floating-ip detach web-1 --ip 203.0.113.42 patrii floating-ip attach web-2 --ip 203.0.113.42
data "patrii_network" "public" {
name = "public"
}
resource "patrii_floating_ip" "web" {
floating_network_id = data.patrii_network.public.id
}
resource "patrii_floating_ip_associate" "web" {
floating_ip_id = patrii_floating_ip.web.id
instance_id = patrii_instance.web.id
}Limits & specifications
Floating IP actions:
| Action | What it does |
|---|---|
Allocate | Reserves a public address into your project. |
Associate | Points the address at an instance's fixed IP. |
Disassociate | Detaches the address, leaving it allocated for reuse. |
Release | Returns the address to the pool. |
Best practices
- Reuse one floating IP across deploys by moving it, rather than changing published addresses.
- Pair every floating IP with a tight security group; a public address is only as safe as the ports you open.
- Release addresses you no longer use so they do not sit idle against your quota.
- For services behind many instances, point a load balancer at them and give the load balancer the floating IP instead of individual servers.
FAQ
I associated a floating IP but the instance is still unreachable.
Can I keep a floating IP while rebuilding a server?
Can two instances share one floating IP?
Learn more
Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.