> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# vastai update instance

Update recreate an instance from a new/updated template

## Usage

```bash theme={null}
vastai update instance ID [OPTIONS]
```

## Arguments

<ParamField path="id" type="integer" required>
  id of instance to update
</ParamField>

## Options

<ParamField path="--template_id" type="integer">
  new template ID to associate with the instance
</ParamField>

<ParamField path="--template_hash_id" type="string">
  new template hash ID to associate with the instance
</ParamField>

<ParamField path="--image" type="string">
  new image UUID for the instance
</ParamField>

<ParamField path="--args" type="string">
  new arguments for the instance
</ParamField>

<ParamField path="--env" type="object">
  new environment variables for the instance
</ParamField>

<ParamField path="--onstart" type="string">
  new onstart script for the instance
</ParamField>

## Description

Example: vastai update instance 1234 `--template_hash_id` 661d064bbda1f2a133816b6d55da07c3

## Examples

```bash theme={null}
vastai update instance <ID>
```

## Global Options

The following options are available for all commands:

| Option          | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--url URL`     | Server REST API URL                                   |
| `--retry N`     | Retry limit                                           |
| `--raw`         | Output machine-readable JSON                          |
| `--explain`     | Verbose explanation of API calls                      |
| `--api-key KEY` | API key (defaults to `~/.config/vastai/vast_api_key`) |
