Provision Instance
How to provision an instance using availability data
Instances -> Read and write
permissionRetrieving offers from the availability API
Our goal is to provision H100 GPU using availability data. First, we need to call the availability endpoint to get the current offers:
We will use the Hyperstack provider and the following offer:
This GPU configuration has fixed resources, so we don’t have to worry about those and just use the default ones.
Creating the Instance Request Body
First, lets go through the Create Pod endpoint and explain how it works. The request requires a body
with pod
, provider
and optional team
definitions.
pod
The pod
object defines the instance’s characteristics:
We can choose any name
, but the rest of the parameters is copied from the availability offer. Since this offer includes a dataCenterId
and country
, we’re going to pass those values during provisioning, as it indicates that the provider has GPUs with the same cloudId
available in different locations. We also copy the rest of the GPU definition data:
gpuType -> gpuType
socket -> socket
gpuCount -> gpuCount
security -> security
Last thing to do is to select an image
. Available values are stored within the images
property of the availability offer. We’re going to select the default ubuntu_22_cuda_12
image.
provider
The provider
object is straightforward, we only need to specify the type
, which in our case is hyperstack
.
team
If you want to assign the pod to a specific team
, include the team object.
teamId
on your Team’s Profile pageSending the Create Request
With all parts configured, the final request looks like this:
On successful completion, you should receive a 200 OK
response with the pod details in the Response Body.
Modifying instance resources
If the availability offer allows resource customization, you can adjust the default resources during provisioning. Below is an example of a modified resource configuration:
This configuration enables changes to disk
and vcpu
specifications.
vcpu
is included in price (defaultIncludedInPrice
set to true
) the default disk is not, which results in an additional cost of $0.03 when using the default disk size.Increase disk size
To increase the disk size, set a new value in the pod
property when sending the create request. For this example, since the provider supports increments of 10 with a minimum of 50, we’ll set the disk size to 200. This adjustment will affect the total hourly cost as follows:
So the final request will look like:
Modifying vcpu
This case is a little more complicated. Because defaultIncludedInPrice
allows us to use default of 16 vcpus for free, there are 2 options in which we’re going to pay additional amount for vcpus
Increasing vcpu
Raising vcpu
to 20 will increase the cost beyond the base instance price:
Decreasing vcpu
Reducing vcpu
to 10 can also increase costs compared to the default configuration. This is because some servers use predefined containers, and altering configurations may incur additional fees, making it more economical to use the default setup:
Example request with adjusted disk and vcpu
With both disk
and vcpu
increased our request will look like:
and the total cost breakdown is as follows:
Dynamic pricing
Certain offers feature dynamic pricing, meaning that rates may fluctuate throughout the instance’s lifetime due to factors such as:
- Price being pegged to a foreign currency and fluctuating with exchange rates
- Payment in alternative currencies or tokens
- Market-based pricing
If an offer supports dynamic pricing, prices -> isVariable
will be set to true
. In this case, it’s recommended to specify a maxPrice
when provisioning the instance to set a cap:
This configuration limits provisioning to instances at or below the specified price. However, prices may still vary during the instance’s lifetime.
Using Custom Templates
When creating an instance, you may want to use your own custom environment instead of the options available through the availability endpoint. You can select from any public templates or your private ones, which you can view on the Templates Page.
To use a custom template, you need to copy its customTemplateId
and set the image
to custom_template
.
Here’s an example request to use a custom template: