Skip to main content
Update/recreate an instance from a new/updated template.

Signature

VastAI.update_instance(
    id: int,
    template_id: Optional[int] = None,
    template_hash_id: Optional[str] = None,
    image: Optional[str] = None,
    args: Optional[str] = None,
    env: Optional[loads] = None,
    onstart: Optional[str] = None
) -> dict

Parameters

id
int
required
id of instance to update
template_id
Optional[int]
new template ID to associate with the instance
template_hash_id
Optional[str]
new template hash ID to associate with the instance
image
Optional[str]
new image UUID for the instance
args
Optional[str]
new arguments for the instance
env
Optional[loads]
new environment variables for the instance
onstart
Optional[str]
new onstart script for the instance

Returns

dict

Example

from vastai import VastAI

client = VastAI(api_key="YOUR_API_KEY")
result = client.update_instance(id=12345)
print(result)