Learn how to configure Public Cloud instances within your vRack using the OVHcloud APIv6.
OVHcloud vRack is a private network solution that enables you to route traffic between OVHcloud dedicated servers as well as other OVHcloud services. At the same time, it allows you to add Public Cloud instances to your private network to create an infrastructure of physical and virtual resources.
Requirements
- A Public Cloud project in your OVHcloud account
- An OpenStack user account
- Basic networking knowledge
- Consulting the guide Configuring the vRack on Public Cloud (to understand the different methods to manage the vRack with the Public Cloud)
- Consulting the guide First steps to use the OVHcloud API (to familiarize yourself with the OVHcloud API)
Instructions
Step 1: Activate and manage a vRack
Connect to the OVHcloud API using the following guide First steps with the OVHcloud API.
Once logged in, follow the steps described below:
Create a cart
For this case, ordering a vRack is free. Copy the ID for your cart (cartId), you will need it later in the process.
Obtaining required information to order the vRack
GET /order/cart/{cartId}/vrack
cartId, duration, planCode, et pricingMode.
Adding the vRack to the cart
POST /order/cart/{cartId}/vrack
For vRack:
cartId: [The ID copied from the first step]
duration: « P1M » planCode: « vrack »
pricingMode: « default »
quantity: 1
Once you have added the vRack to the cart, you should receive an itemID. Copy this, it will be useful for making modifications before checking out.
Validating the cart
Once the items have been placed in the card, you will need to checkout:
POST /order/cart/{cartId}/checkout
Final validation of the order
To validate the order, there are two possible methods:
-
Go to the URL given when checking out.
-
Validate using the following API call: POST /me/order/{orderId}/payWithRegisteredPaymentMean
Once the free order has been validated, it may take a few minutes for the vRack to be activated.
Step 2: Add your Public Cloud project to the vRack
Once the vRack is active, you will need to assign your Public Cloud projects to the vRack.
Connect to the OVHcloud API using the following guide: First steps with the OVHcloud API.
If you do not know your Public Cloud project ID, the following calls will allow you to obtain it.
Identifying the project
GET /cloud/project/{serviceName}
Adding the project to the vRack
Once you have identified the project and vRack, you can associate them with the following API call:
POST /vrack/{serviceName}/cloudProject
Fill in the fields with the information previously collected:
serviceName: name of the vRack in the form "pn-xxxxxx"
project: The Public Cloud project ID, in a string of 32 characters.
Checking the progress of the task
You can view the progress of the task with the help of the following API call:
GET /vrack/{serviceName}/cloudProject/{project}
Step 3: Create a VLAN on the vRack
A VLAN (Virtual Local Area Network) will need to be created so that your instances can communicate with each other over the vRack.
With the Public Cloud, you can create up to 4,000 vLANs in a single vRack. This means that you can use each private IP up to 4000 times. Thus, for example, the IP 192.168.0.10 on VLAN 2, will be different than 192.168.0.10 on vLAN 42.
This can be useful for segmenting your vRack between multiple virtual networks.
From the OVHcloud API, you can customize the settings: IP range (e.g. 10.0.0.0/16), deployment zones, DHCP, Gateway, etc.
The OpenStack infrastructure requires that you specify your VLAN number directly at the hardware level.
Unlike dedicated servers, it is not necessary to tag a VLAN directly on the instance.
Because OpenStack is not located at the same level, you will not be able to customize VLANs through the Horizon interface or OpenStack APIs.
Once logged into the API, execute the calls the following in order:
Retrieving the required information
Public Cloud Project
GET /cloud/project/{serviceName}
vRack
GET /cloud/project/{serviceName}/vrack
Creating a private network
POST /cloud/project/{serviceName}/network/private
serviceName: ID of the project
name: name of the VLAN.
You can leave the “Region” field empty if you want it to be active in all regions.
The “vLanID” is required to create a specific VLAN.
The creation will take a few minutes.
To verify the details of your VLANs, you can use the following API call:
GET /cloud/project/{serviceName}/network/private
For example, for VLAN 42 it would appear as: pn-xxxxxx_42
Creating a subnet
By default, if you do not specify a subnet, the IP range used is the following:
10.0.0.0/16
If you want to manage the IP assignments yourself, you will need to create a subnet.
To do this, once the VLAN is created, you will need to create the subnet for each affected area using the following API call:
POST /cloud/project/{serviceName}/network/private/{networkId}/subnet
You can fill out the fields according to the following:
Field | Description |
---|---|
serviceName | ID of the project |
networkId | Your network ID, retrieved with previous steps. Example: pn-xxxxxx_42 for VLAN 42 |
dhcp | Check box for enabling / uncheck for disabling DHCP in the VLAN |
end | Last address of the subnet in this region. Example: 192.168.1.50 |
network | Subnet IP block. Example: 192.168.1.0/24 |
region | Example: VIN1 |
start | First address of the subnet in this region. Example: 192.168.1.15 |
You will have to do the same for each area where your instances are present.
From 192.168.0.2 to 192.168.0.254 for VIN1
From 192.168.1.2 to 192.168.1.254 for HIL1
Step 4: Adding an instance to the vRack
Two situations may exist:
- The instance does not exist yet.
- The instance already exists and you must add it to the vRack.
In case of a new instance
Once connected to the API, execute the following commands in order.
Retrieving required information
Retrieving project ID:
Retrieving the public networkID (EXT-NET)
GET /cloud/project/{serviceName}/network/public
Retrieving the network ID from the private network (previously created vRack interface)
GET /cloud/project/{serviceName}/network/private
Retrieving the ID of the chosen instance type (flavorId)
GET /cloud/project/{serviceName}/flavor
Retrieving the ID of the chosen image (imageId)
GET /cloud/project/{serviceName}/image
Retrieving your OpenStack SSH Key ID (sshKeyId)
GET /cloud/project/{serviceName}/sshkey
If you haven’t added an SSH key to your client space yet, you can do so through the following API:
POST /cloud/project/{serviceName}/sshkey
Deploying the instance
Once all the elements necessary for the deployment are gathered, you can use the following call:
POST /cloud/project/{serviceName}/instance
You will need to enter at least the following fields:
Field | Description |
---|---|
serviceName | ID of the Public Cloud project |
flavorId | ID of the instance type (example: S1-2, B2-7, WIN-R2-15...) |
imageId | ID of the image for the deployment (example: Debian 9, Centos 7...) |
name | Name for your instance |
networks | In the "networkId" section, indicate the public network identifier (Ext-Net) or your VLAN (pn-xxxxxx_yy). You can click the "+" button to add more networks. |
region | Region for your instance deployment (example: VIN1) |
sshKeyId | ID of your OpenStack SSH key |
Once the call is executed, if all information is correctly filled in, the instance will be created with one or more network interfaces.
In case of an existing instance
If you need to integrate an existing instance into vRack, you will not be able to do so from your OVHcloud client space. To do this, you will have to go through Horizon, the OpenStack APIs, or the OVHcloud API.
The action will simply be to add a new network interface to your server, in addition to the existing one.
So, for example, if you have a public interface eth0, you will add the eth1 interface.
The steps below describe how to manage your instances’ network interfaces.
Retrieving required information
Retrieving project ID:
Retrieving Instance ID:
GET /cloud/project/{serviceName}/instance
Retrieving the public networkID (EXT-NET):
GET /cloud/project/{serviceName}/network/public
Retrieving the network ID from the private network (previously created vRack interface):
GET /cloud/project/{serviceName}/network/private
Adding an interface to your instance
Once all the necessary information is retrieved, you can use the following call:
POST /cloud/project/{serviceName}/instance/{instanceId}/interface
You will need to enter at least the following fields:
Field | Description |
---|---|
serviceName | ID of the Public Cloud project |
instanceId | ID of the instance |
networkId | Enter the public network identifier (Ext-Net) or your VLAN (pn-xxxxxx_yy) |
ip | Define a specific IP (only works for private interfaces) |
Once the call is complete, if all information is correctly filled in, a new interface will be added to your instance.
You can see in the instance summary the private IP address automatically assigned to your interface.
It is your responsibility to use it by configuring your interface through DHCP or by using your own IP through a static IP configuration.
Removing an interface from your instance
In case you remove the “Ext-Net” interface (public IP), this address will be released and recycled. So you couldn’t reassign it to yourself.
This action is only to be performed if you want to isolate your server in the vRack (Ext-Net interface) or exit it from a vLan.
Once all the necessary information is retrieved, you can use the following call to remove an interface:
DELETE /cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}
You will need to enter at least the following fields:
Field | Description |
---|---|
serviceName | ID of the Public Cloud project |
instanceId | ID of the instance |
networkId | Enter the public network identifier (Ext-Net) or your VLAN (pn-xxxxx_yy) |
Go further
For more information and tutorials, please see our other Public Cloud Networking support guides or explore the guides for other OVHcloud products and services.