Creating an instance without a public IP
By default a new instance gets two addresses: one on your project’s private network and a public floating IP. For anything that should not be reachable from the internet — a database, a worker, an internal service — you can skip the public one at creation.
Verified on production: the request below was run for real, and the instance came up with only its private address.
The request
Section titled “The request”Add "skip_floating_ip": true to a normal create. Everything else is the same as
creating any instance, including the eight required fields:
curl -X POST https://console.cloudlogics.com/api/v1/vm/create \ -H "Authorization: Bearer $CL_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "my-private-vm", "flavor_id": "bx1aL", "image_id": "232f283d-672b-4aee-a2dc-71bebdb535df", "size": "1", "region": "us-ftw-1", "id": "42", "owner": "your-username", "project": "my-project-a1b2", "skip_floating_ip": true }'Returns 202:
{ "data": "server provisioning" }As with any create, the instance does not exist yet and the response carries no instance id. Provisioning takes about a minute.
What you get
Section titled “What you get”Once it is up, GET /vm shows the instance with only the
private-network address — there is no public entry at all:
"addresses": { "my-project-a1b2_private_network": ["172.26.8.197"] }Compare an instance created without the flag, which lists both a private address and a public one.
Reaching it
Section titled “Reaching it”The instance can talk to, and be reached from, other instances on the same private network. To administer it, go through an instance that does have a public IP — for example, SSH to a public instance and from there to the private one.
Security group rules still apply. A rule with remote_ip set to your private network’s
range (for example 172.26.8.0/24) lets other instances in the project reach it while
nothing else can.
Things to know
Section titled “Things to know”- The decision is made at creation. There is currently no API operation to attach a public IP to a running instance. If you later need one, create a new instance without the flag.
- Leaving the flag out, or setting it to
false, gives the instance a public IP — the default behaviour, also verified on production. sizeis still required, and still leaves a data volume behind when the instance is deleted. See deleting an instance.
