# unikraft instances edit

Edit an instance.

```
unikraft instances edit <target> [flags]
```

## Examples

Resize instance memory:

```bash
unikraft instance edit demo-instance --memory 256
```

Attach a ROM image to an instance:

```bash
unikraft instance edit demo-instance \
	  --set roms=name=my-rom,image=myuser/my-rom:latest,at=/rom0
```

Add a ROM to an instance without replacing existing ones:

```bash
unikraft instance edit demo-instance \
	  --add roms=name=mydata,dir=./mydata,at=/rom
```

Remove a ROM from an instance by name:

```bash
unikraft instance edit demo-instance --del roms=my-rom
```

Attach a volume to an instance:

```bash
unikraft instance edit demo-instance --add volumes=my-vol:/data
```

Detach a volume from an instance:

```bash
unikraft instance edit demo-instance --del volumes=my-vol
```

## Options

```
  --add <name>=<value>        Key-value pairs to add to the instance.
  --add-file <name>=<filename>  Files containing key-value pairs to add to the instance.
  --annotation <key>=<value>  Key-value metadata: up to 256 entries with Kubernetes-style [prefix/]name keys. Unlike tags, annotations reach the guest in its start data.
  --args arg                  Command-line arguments passed to the instance at start.
  --autokill <key>=<value>    Autokill options.
  time: time after the instance stops before it is deleted, such as 5s or 24h, 0 disables
  num-requests: delete the instance after it has served this many requests or connections
  --cmd CMD                   Run a command to edit fields (receives YAML on stdin, outputs edited YAML on stdout).
  --del <name>=<value>        Keys to delete from the instance.
  --del-file <name>=<filename>  Files containing keys to delete from the instance.
  --delete-lock               Prevent deletion until the lock is removed. Also pauses autokill.
  --dry-run                   Print patches without applying them.
  -e, --env <key>=<value>     Environment variable as KEY=value.
  -f, --field FIELD           Specify which fields to include in the output.
  --image <name>:<tag>        Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
  --load LOAD                 Load fields from a YAML file.
  -m, --memory size           Memory for the instance, within the range the plan allows (see quotas.limits.memory on the metro). Defaults to 128MiB on create.
  -o, --output OUTPUT         Output format. One of: kv, table, json, yaml, raw, quiet, template.
  --plugin name=<name>,image=<ref>[,config=<json>]  Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
  --rom name=<name>,image=<ref>,at=<path>  Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
  --save FILE                 Save editable fields as YAML to a file (use - for stdout).
  --scale-to-zero <key>=<value>  Scale-to-zero options. Traffic through a service or to the private IP wakes the instance.
  policy: on | idle (also while open TCP connections are idle, needs stateful=true) | off
  cooldown-time: ms of inactivity before scaling to zero
  notify-time: ms the instance is warned beforehand, 0 disables and the value must be below cooldown-time
  stateful: true keeps RAM in a snapshot and resumes from it, false restarts from scratch
  --sched-priority priority   Scheduling priority: normal (default), medium, high or admin. Requires the override_vm_priority permission.
  --set <name>=<value>        Key-value pairs to set on the instance.
  --set-file <name>=<filename>  Files containing key-value pairs to set on the instance.
  --tag tag                   Tags for grouping and filtering: up to 16, each 1 to 256 characters of letters, digits and -+_.:=. Not visible to the guest.
  --vcpus n                   Number of vCPUs, within the range the plan allows (see quotas.limits.vcpus on the metro). Defaults to 1 on create.
  --visual                    Open an editor to modify fields visually.
```

## Options inherited from parent commands

```
  --config file               Path to the configuration file.
  --log-level level           Set the logging level. (default info)
  --log-type type             Set the log type. (default text)
  --profile name              Set the current profile.
  --telemetry                 Toggle usage analytics. (default true)
  --timeout duration          Set a deadline for the command (e.g. 30s, 5m, 1h).
```

## See Also

* [`unikraft instances`](../instances.mdx): Manage Unikraft Cloud instances.

