Quickstart
In this guide, we will cover the basic operations for GPU instances on Shadeform via the API. Alternatively, you can perform all of thet same operations via the UI.
Prequisites
There are two pre-requisites for this guide:
- After you have created your account, you must top up your wallet here.
- After you have topped up your wallet, generate and retrieve your Shadeform API key here.
Finding a GPU instance
Use the /instances/types API to query for your desired instance. For this guide, we will query for the cheapest available A6000 instance. Make sure to replace <api-key>
with your own API Key retrieved from here.
You should get a response like the JSON snippet below. The response will have an array of the instances that match the search criteria sorted by price. We only need to look at the first entry in the array. Don’t worry! We don’t need all of that data to launch an instance. We only care about the cloud
, region
, and shade_instance_type
fields.
Launching the instance
After we have found the cheapest A6000 that’s available, we will launch the GPU instance using the /instances/create API. Using the values from the previous JSON snippet, we can fill in request payload fields for cloud
, region
, and shade_instance_type
.
If you encounter an error that implies that the selected instance is out of capacity, please try the next instance returned in the response. Sometimes GPU availability can change rapidly!
The response from the API will look like the JSON snippet below. We will need the id
property for further requests.
Checking the status of the instance
Now that we have created the GPU instance, we must wait for the instance to spin up. We can check on the status of the instance by calling the /instances/info API. We will need to use the id
from the response of the previous step as a URL parameter.
The response from the API look like the JSON snippet below. Just like before, we don’t care about most of these fields right now and can focus on just the important ones. We can look at the status
field to see fi the instance is ready. Right now the instance is pending
.
You can query this API on a loop until status
changes from pending
to active
. This will typically take 4-5 minutes for A6000 instances. When the status turns to active
, the ip
field will also become populated. The response below is when the instance becomes ready.
SSHing into the instance
Once the instance’s status is active
, we can now SSH into the GPU instance. In order to access the GPU instance, you will need to download your Shadeform generated private key. Once you have the private key downloaded, you will need to update the permissions on the key.
You can now SSH into the instance using the following command. Make sure to substitute <ip>
with the ip
found in the response of the API response above.
If you encounter an error that starts with WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
, you can run ssh-keygen -R <ip>
to reset your saved host info.
Restarting the instance
If you ever need to restart an instance, use our /instances/restart API using the instance id
retrieved earlier. Note that a 200 response does not confirm that the instance restarted successfully. It only confirms that the restart request was initiated. You may need to wait a few minutes for the instance to be ready to use again.
Deleting the instance
Once you’ve done with the instance, you can delete the instance by calling the /instances/delete API using the instance id
retrieved earlier.
To learn more about Shadeform, check out these additional guides.