Deploy your multi-server applications with GandiCloud VPS private networks

We’re currently introducing a new feature to GandiCloud VPS: private networks.
This feature is currently available via our public API and we are working on making it as user-friendly as possible and adding it to your Gandi administration interface in the near future.

Private networks enable communication between several servers deployed in Gandi’s infrastructure, even if not all of them interface on the public network. In this way, we avoid unnecessarily exposing machines and services to the public network.

Example of private network deployment on GandiCloud VPS

Like all GandiCloud VPS features, private networks can be managed via our OpenStack public API.

It is therefore possible to manage GandiCloud VPS resources (servers, volumes, networks, etc.) using all the tools that interface with OpenStack, such as Terraform or its recent fork OpenTofu.

You can also use the OpenStack CLI, for which our documentation is available by following this link.

As an example, in this article we propose to deploy a server asciinema, a software application that hosts our own console recordings, using OpenTofu.

This demo deployment will be based on a code repository available on Github, which describes the GandiCloud VPS resources used:

  • A private network ‘asciinema_private_network’ with its subnet (‘’)
  • 1 ‘db_server’ server hosting a PostgreSQL database which will listen on an address of this private network
  • 1 ‘asciinema_server’ server hosting the asciinema-server service, connected to its database via the private network.

The ‘asciinema_server’ server will also be connected to the public network so that it can expose its service on the Internet. To keep things simple, we’ll also provide the database server with a public IP so that it can retrieve the packets needed for its installation.

As a bonus, the provider Terraform Gandi will enable us to automatically configure the DNS zone of our domain name registered with Gandi, so that we can easily access our new service.


To perform this deployment we will need:

  • Git,
  • OpenTofu,
  • A configuration file for the GandiCloud VPS OpenStack API, which you can create using this documentation
  • A Personal Access Token to access Gandi’s LiveDNS public API, which you can create in your Gandi account (more information in the public API documentation). This token must have permission to manage your domain’s DNS zone using liveDNS.

Initial configuration

Let’s start by sourcing the OpenStack access file so that our current shell contains the environment variables required for authentication on GandiCloud VPS:


In order to retrieve the deployment sources, we can now clone the following directory and initialize OpenTofu:

git clone
cd demo-private-networks-gandicloud
tofu init

We can now provide our Gandi personal access token:

source ./

A final configuration file is required to indicate the specific parameters of our deployment, which we could copy with a name known by OpenTofu:

cp terraform.tfvars.example terraform.tfvars

All that remains is to edit its contents:

admin_ssh_pubkey = “
manage_dns_record_using_livedns = true
asciinema_server_domain_apex = “
asciinema_server_subdomain = “

We’re ready to deploy!


Once the environment has been set up, deployment with a tool like Terraform or OpenTofu is extremely simple and relies on 2 commands:

tofu plan
tofu apply

The first will enable you to check the changes to be made (it will therefore list all the resources to be created before deployment). The second will apply these changes.

After executing these commands and deploying your infrastructure, you should see information about your new infrastructure displayed:

To connect to the DB server: ssh
To connect to the asciinema server: ssh
Your private network asciinema_private_network has 1 subnet: 

– asciinema server has private IP  

– DB server has private IP To register, you can visit http://
To upload your record to your server using the asciinema client:
  ASCIINEMA_API_URL=http:// asciinema rec

Note that the installation of the various applications is carried out via ‘cloud-init’ when the servers boot. This may therefore take a few seconds after the servers have been booted. To monitor installation progress, take a look at the ‘/var/log/cloud-init-output.log’ file on your servers.

If you’d like to find out more about the configuration options for the asciinema server, check out the dedicated documentation.

Finally, if you wish to delete resources, simply use the following command:

tofu destroy

For more information on using private networks, please refer to our documentation

Other GandiCloud VPS features for your infrastructure

This very simple deployment is intended to demonstrate the use of private networks on GandiCloud VPS. However, for deployments of applications hosting your data or production, GandiCloud VPS offers many other features that you can integrate into your deployments and control via API or our interface. Some of these features include:

Don’t hesitate to share your feedback with us at [email protected]!

Related Posts