# Azion CLI function-instance

The Azion CLI `function-instance` commands create, list, describe, update, and delete [function instances](/en/documentation/platform/applications/functions-instances/). A function instance binds one [function](/en/documentation/platform/functions/) to one application and carries the arguments that the function code receives. Options shared by every command, such as `--format`, `--out`, and `-y`, are listed on [Global options](/en/documentation/devtools/cli/globals/).

---

## Create

`azion create function-instance` adds a function to an application as a function instance:

```bash
azion create function-instance [flags]
```

| Flag               | Short | Type   | Default  | Description                                                                                                      |
| ------------------ | ----- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `--active`         | —     | string | `"true"` | Sets whether the function instance is active (`true`) or not (`false`).                                          |
| `--application-id` | —     | int    | —        | ID of the application that receives the function instance.                                                       |
| `--args`           | —     | string | —        | Path to a JSON file with the arguments of the function instance.                                                 |
| `--file`           | —     | string | —        | Path to a JSON file with the attributes of the function instance. Use `-` to read the JSON from standard input.  |
| `--function-id`    | —     | int    | —        | **Required** unless `--file` is set. ID of the function to instantiate. Without it, the command asks for the ID. |
| `--name`           | —     | string | —        | Name of the function instance.                                                                                   |

`--args` takes the path of a JSON file, not the JSON itself. Inline JSON fails with this error:

```text
Error: Failed to read the args file. Verify if the file name and its path are correct and the file's content has a valid JSON format. Run the command again using the --help flag to display more information and try again: open {"greeting":"instance"}: no such file or directory
```

This file holds the arguments for the function instance:

```json
{
  "greeting": "instance"
}
```

This command creates a function instance named `my-instance` from the function with ID `12359` in the application with ID `1234567890`, and passes it the arguments in `fi-args.json`:

```bash
azion create function-instance --application-id 1234567890 --function-id 12359 --name my-instance --args fi-args.json
```

The command prints the ID of the function instance:

```text
Created Function Instance with ID 12361
```

---

## List

`azion list function-instance` lists the function instances of an application, 50 to a page:

```bash
azion list function-instance [flags]
```

| Flag               | Short | Type   | Default | Description                                                                                               |
| ------------------ | ----- | ------ | ------- | --------------------------------------------------------------------------------------------------------- |
| `--application-id` | —     | int    | —       | ID of the application whose function instances you list.                                                  |
| `--details`        | —     | —      | —       | Adds the `LAST EDITOR` and `LAST MODIFIED` columns to the `ID`, `NAME`, `ACTIVE`, and `FUNCTION` columns. |
| `--filter`         | —     | string | —       | Name to filter the list by.                                                                               |
| `--order-by`       | —     | string | —       | Field to sort the list by.                                                                                |
| `--page`           | —     | int    | `1`     | Number of the page to return.                                                                             |
| `--page-size`      | —     | int    | `50`    | Number of function instances on each page.                                                                |

This command lists the function instances of the application with ID `1234567890`:

```bash
azion list function-instance --application-id 1234567890
```

The command prints one row per function instance, with the ID of the function it runs:

```text
ID     NAME                 ACTIVE  FUNCTION
12361  my-instance          true    12359
12362  my-other-instance    true    12359
```

---

## Describe

`azion describe function-instance` prints the settings of one function instance:

```bash
azion describe function-instance [flags]
```

| Flag               | Short | Type | Default | Description                                             |
| ------------------ | ----- | ---- | ------- | ------------------------------------------------------- |
| `--application-id` | —     | int  | —       | ID of the application that holds the function instance. |
| `--instance-id`    | —     | int  | —       | ID of the function instance to describe.                |

This command describes the function instance with ID `12361`:

```bash
azion describe function-instance --application-id 1234567890 --instance-id 12361
```

The command prints the ID, the name, the function, and the last change of the function instance:

```text
ID:              12361
Name:            my-instance
Function:        12359
Last Editor:     you@example.com
Last Modified:   "2026-01-01T12:00:00.08975Z"
```

The plain output leaves out the arguments. With `--format json`, the command prints the full object: `active`, `args`, `azion_form`, `created_at`, `function`, `id`, `last_editor`, `last_modified`, and `name`. For the function instance above, `args` holds the object read from `fi-args.json`:

```text
{
 "active": true,
 "args": {
  "greeting": "instance"
 },
 "azion_form": {},
 "created_at": "2026-01-01T12:00:00.090238Z",
 "function": 12359,
 "id": 12361,
 "last_editor": "you@example.com",
 "last_modified": "2026-01-01T12:00:00.08975Z",
 "name": "my-instance"
}
```

---

## Update

`azion update function-instance` changes the attributes of a function instance:

```bash
azion update function-instance [flags]
```

| Flag               | Short | Type   | Default  | Description                                                                                      |
| ------------------ | ----- | ------ | -------- | ------------------------------------------------------------------------------------------------ |
| `--active`         | —     | string | `"true"` | Sets whether the function instance is active (`true`) or not (`false`).                          |
| `--application-id` | —     | int    | —        | ID of the application that holds the function instance.                                          |
| `--args`           | —     | string | —        | Path to a JSON file with the new arguments of the function instance.                             |
| `--file`           | —     | string | —        | Path to a JSON file with the attributes to change. Use `-` to read the JSON from standard input. |
| `--function-id`    | —     | int    | —        | ID of the function the instance runs.                                                            |
| `--instance-id`    | —     | int    | —        | ID of the function instance to update.                                                           |
| `--name`           | —     | string | —        | New name of the function instance.                                                               |

A function instance stays active. With `--active false`, the API refuses the update and the command fails with this error:

```text
Error: Failed to update the Function Instance: ["You can't deactivate a function instance."]. Check your settings and try again. If the error persists, contact Azion support
```

This command renames the function instance with ID `12361` to `my-instance-renamed`:

```bash
azion update function-instance --application-id 1234567890 --instance-id 12361 --name my-instance-renamed
```

The command prints the ID of the updated function instance. The arguments and the active state keep their values:

```text
Updated Function Instance with ID 12361
```

---

## Delete

`azion delete function-instance` removes a function instance from an application:

```bash
azion delete function-instance [flags]
```

| Flag               | Short | Type | Default | Description                                             |
| ------------------ | ----- | ---- | ------- | ------------------------------------------------------- |
| `--application-id` | —     | int  | —       | ID of the application that holds the function instance. |
| `--instance-id`    | —     | int  | —       | ID of the function instance to delete.                  |

This command deletes the function instance with ID `12362`:

```bash
azion delete function-instance --application-id 1234567890 --instance-id 12362 -y
```

The command confirms the deletion and prints the ID as `%!s(int64=12362)`:

```text
Function Instance %!s(int64=12362) was successfully deleted
```

---

## Use a JSON file

`azion create function-instance` and `azion update function-instance` read the attributes of the function instance from a JSON file with `--file`. Inside the file, `args` is a JSON object, not a path.

This file creates an active function instance named `my-other-instance` from the function with ID `12359`. The command reads `name`, `function`, `active`, and `args` from it:

```json
{
  "name": "my-other-instance",
  "function": 12359,
  "active": true,
  "args": {"greeting": "from-file"}
}
```

Pass the file to the create command with the ID of the application:

```bash
azion create function-instance --application-id 1234567890 --file fi-create.json
```

The command prints the ID of the function instance:

```text
Created Function Instance with ID 12362
```

On update, pass the ID of the application and the ID of the function instance on the command line. This file changes the name and the arguments of the function instance with ID `12362`:

```json
{
  "name": "my-other-instance-updated",
  "args": {"greeting": "updated-from-file"}
}
```

Pass the file to the update command:

```bash
azion update function-instance --application-id 1234567890 --instance-id 12362 --file fi-update.json
```

The command prints the ID of the updated function instance:

```text
Updated Function Instance with ID 12362
```

Fields that the file leaves out keep their values: the function instance above stays active.

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `--format`, `--out`, and `-y`.
- [Functions](/en/documentation/platform/functions.md): What a function runs and how its instances pass it arguments.
- [Azion CLI function](/en/documentation/devtools/cli/resources/function.md): The commands that create the function a function instance runs.
- [Azion CLI rules-engine](/en/documentation/devtools/cli/resources/rules-engine.md): The commands that create the rules that run a function instance.
