If you want to create a web front-end or a reverse proxy to create a stack of VMs (web server, database), you will need to add a public IP address to create en entry point.
This guide explains how to use the Nutanix API to deploy a Ubuntu VM with a public IP address.
Warning
OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend that you contact the OVHcloud Professional Services team or a specialist service provider if you have difficulties or doubts concerning the administration, usage or implementation of services on a server.
Requirements
A Nutanix cluster in your OVHcloud account
Login credentials and URL for Prism Central, received via email after the installation
Access to the
An available Additional IP address
Instructions
Adding a new Additional IP to your vRack
Log in to the and add an Additional IP address to your vRack.
Info
The following instructions will use the IP block 123.45.6.78/30 for example purposes.
For vRack purposes, the first, penultimate, and last addresses in any given IP block are always reserved for the network address, network gateway, and network broadcast respectively. This means that the first usable address is the second address in the block, as shown below:
To configure the first usable IP address, you need to edit the network configuration file.
Info
In this example, the subnet mask (255.255.255.252) is appropriate for the IP address range used. Your subnet mask may differ, depending on the size of your block. When you purchase your IP block, you will receive an email notifying you of the subnet mask to use.
On Ubuntu 20.04 LTS (Focal Fossa) with "netplan", the configuration should be as follows:
In the metadata you can find the UUID, in this case: ed156bb0-a838-4596-b427-4bbed1968864.
Step 3: Create the necessary files
To deploy the VM you need two files: vm.json, describing the VM and the cloud-init.yaml configuration file which contains the user data such as password, network etc.
Now you have to create the cloud-init.yaml file. This file contains the "user data". When the system boots, these parameters such as users, package, files etc. will be applied to the VM.
Below, find a template that you can amend with your values to create your individual VM.
Info
Change "hostname", "fqdn", "name", "passwd", "ssh-autorized-keys" and ip addresses with the desired values.
This file will create the file for netplan, apply the configuration, and initiate a reboot.
The password must be a hash value. You can generate it with the command below.
mkpasswd --method=SHA-512 --rounds=4096
#cloud-confighostname: <yourhostname>fqdn: <yourhostname.ovh.cloud>users: - name: <yourusername> sudo: ['ALL=(ALL) NOPASSWD:ALL'] groups: sudo shell: /bin/bash lock_passwd: false passwd: <yourhashpass> ssh-authorized-keys: <your public ssh key>write_files: - path: /etc/netplan/50-cloud-init.yaml content: | network: version: 2 renderer: networkd ethernets: ens3: addresses: [123.45.6.77/30] gateway4: 123.45.6.78 nameservers: addresses: [213.186.33.99]runcmd: - netplan generate - netplan apply# Optional: if you want to use access via password instead of SSH key, uncomment the next line# - sed -i s/PasswordAuthentication/#PasswordAuthentication/g /etc/ssh/sshd_config - reboot
Step 4: Create the VM
Transform the cloud-init.yaml into "base64" and put it into a variable:
USERDATA=$(base64 -w 0 cloud-init.yaml)
Then replace the chain "USERDATA" in vm.json with the value of the USERDATA variable in the vm.json file:
sed -i s/USERDATA/${USERDATA}/g vm.json
Finally, use a cURL request to register and power on the VM:
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.