# Azion CLI

A command-line interface (CLI) for a cloud platform is a program you run in a terminal. You act on your account with typed commands instead of a web interface, and a token saved on your machine authorizes each command. Because every action is a command, the same steps run by hand, in a script, or in a CI/CD pipeline.

**Azion CLI** puts the Azion Platform behind one terminal command, `azion`, an [open-source](https://github.com/aziontech/azion-cli/) binary written in Go. It has two command families. Project commands set up the project in the current folder, run it locally, and build and deploy it. Resource commands create, list, describe, update, and delete one platform resource at a time, with the form `azion <verb> <noun>`. Use the Azion CLI to deploy a site or a function, test it locally, manage resources as code, or automate deploys in CI/CD pipelines.

A build runs in [Azion Bundler](https://github.com/aziontech/bundler), an open-source framework adapter. `azion build` and `azion deploy` run the bundler with the preset of the project, and the bundler adapts the output of a web framework to run on the Azion Platform. For how the two command families reach the platform, refer to [How Azion CLI works](/en/documentation/devtools/cli/how-it-works/).

You can also manage the same resources through the [Azion API](/en/documentation/devtools/api/) or with the [Azion Terraform Provider](/en/documentation/devtools/terraform/).

[Get started](/en/documentation/devtools/cli/quickstart/)

[Browse the commands](/en/documentation/devtools/cli/resources/)

---

## How the CLI works with your account

The Azion CLI is a client: the resources it creates and changes live in your account, and every command reaches them through the Azion API.

```mermaid
%%{init: {"layout": "dagre", "themeVariables": {"fontSize": "13px"}, "flowchart": {"nodeSpacing": 12, "rankSpacing": 12, "padding": 6, "wrappingWidth": 70, "minNodeWidth": 40, "useMaxWidth": true}}}%%
flowchart LR
  Term["Terminal"] --> Cli["Azion CLI"]
  Proj["Project folder"] -->|"azion deploy"| Cli
  Cli --> Api["Azion API"]
  Api --> Res["Account resources"]
```

1. You run `azion` in a terminal. The CLI authorizes each command with the personal token that it saved on your machine at login.
2. A project command, such as `azion deploy`, runs inside the project folder and reads the `azion/azion.json` file and the `azion.config` file there.
3. The CLI, a Go binary, calls the Azion API.
4. The API creates or updates the resources of your account, such as an application and a workload. After a deploy, the CLI writes the ID of each resource into `azion/azion.json`.

For the build, the project files, and the profiles in detail, refer to [How Azion CLI works](/en/documentation/devtools/cli/how-it-works/).

---

## Project deploy

One command deploys a project. From the folder of a static site, `azion deploy` deploys it:

```bash
azion deploy
```

The command uploads the source files, and the build runs on Azion. The output ends with the domain that serves the site:

```text
Running deploy command
Uploading source files

Upload completed successfully!
Please visit https://console.azion.com/create/deploy/00000000-0000-0000-0000-000000000002 in case it did not open automatically, to follow up the full deploy process
Your Application was deployed successfully

To visualize your application access the Domain: https://xxxxxxxxxx.map.azionedge.net
Your application is being deployed to all Azion Locations and it might take a few minutes.
```

- `Uploading source files` sends the project to Azion, so the build needs no toolchain on your machine. With `--local`, the build runs on your machine instead.
- The Azion Console link opens **Deploy Log**, which shows the progress of the remote build.
- The last lines give the URL of the workload, a `map.azionedge.net` domain.
- The command writes the ID of each resource it created into `azion/azion.json`, so the next deploy updates the same resources.

The first deploy can take several minutes to answer from every location; later deploys take about two minutes. For every flag of the command, refer to [Azion CLI deploy](/en/documentation/devtools/cli/deploy/).

---

## Install the CLI

The install script is the recommended way to install the Azion CLI. It puts the `azion` binary on your path:

```bash
curl -fsSL https://cli.azion.app/install.sh | bash
```

The Azion CLI is also published for package managers. Homebrew, Chocolatey, and Windows Package Manager download the package for you. For RPM, dpkg, APK, and APT, first download the package for your system from the [releases page](https://github.com/aziontech/azion-cli/releases), then install the downloaded file. Each tab shows the command that installs the CLI and the command that updates it:

**Homebrew**

Install the `azion` formula:

```bash
brew install azion
```

Update it to the latest version:

```bash
brew upgrade azion
```

**Windows**

Install the CLI with Chocolatey:

```shell
choco install azion
```

Or install it with Windows Package Manager:

```shell
winget install aziontech.azion
```

To update, run the command for the manager you installed with:

```shell
choco upgrade azion
```

```shell
winget upgrade aziontech.azion
```

**RPM**

Install the RPM package you downloaded from the releases page:

```bash
sudo rpm -i <downloaded_file>
```

To update, download the latest package from the releases page and run the same command on it.

**dpkg**

Install the Debian package you downloaded from the releases page:

```bash
sudo dpkg -i <downloaded_file>
```

To update, download the latest package from the releases page and run the same command on it.

**APK**

Install the APK package you downloaded from the releases page:

```bash
apk add <downloaded_file>
```

To update, download the latest package from the releases page and run the same command on it.

**APT**

Install the Debian package you downloaded from the releases page:

```bash
sudo apt install ./<downloaded_file>
```

To update, download the latest package from the releases page and run the same command on it.

`azion version` confirms the install:

```bash
azion version
```

The command prints the version of the CLI:

```text
Azion CLI 4.23.0
```

The CLI then needs a personal token to act on your account. To save one, refer to [Azion CLI login](/en/documentation/devtools/cli/login/).

---

## What the CLI covers

The Azion CLI covers the life of a project, the resources of an account, and the configuration of the CLI itself:

- **Project commands**: [`azion init`](/en/documentation/devtools/cli/init/) creates a project from a template, and [`azion link`](/en/documentation/devtools/cli/link-command/) sets up an existing folder. [`azion dev`](/en/documentation/devtools/cli/dev-command/) runs the project on a local development server, and [`azion build`](/en/documentation/devtools/cli/build/) and [`azion deploy`](/en/documentation/devtools/cli/deploy/) build and deploy it. [`azion sync`](/en/documentation/devtools/cli/sync/) writes the remote resources back into the project files, [`azion unlink`](/en/documentation/devtools/cli/unlink-command/) detaches the folder, and [`azion rollback`](/en/documentation/devtools/cli/rollback/) serves an earlier deploy of a static site again.
- **Resource commands**: `azion <verb> <noun>` manages applications, functions, workloads, connectors, firewalls, DNS zones, certificates, storage buckets, and tokens, across 28 nouns. [Resource commands](/en/documentation/devtools/cli/resources/) lists each noun and the verbs it takes. [`azion clone`](/en/documentation/devtools/cli/clone/) copies an application under a new name, and [`azion config`](/en/documentation/devtools/cli/config/) manages resources from manifest files.
- **Project configuration**: [azion.config.js](/en/documentation/devtools/cli/azion-config-js/) declares the build settings of a project and the resources it needs on Azion, as code.
- **Account and settings**: [`azion login`](/en/documentation/devtools/cli/login/), [`azion logout`](/en/documentation/devtools/cli/logout/), and [`azion whoami`](/en/documentation/devtools/cli/whoami/) manage the session. [`azion profiles`](/en/documentation/devtools/cli/profiles/) switches between accounts, and [`azion reset`](/en/documentation/devtools/cli/reset/) returns the stored settings to their defaults. The flags every command accepts are on [Global options](/en/documentation/devtools/cli/globals/).
- **Cache**: [`azion purge`](/en/documentation/devtools/cli/purge/) removes cached objects before their TTL ends, and [`azion warmup`](/en/documentation/devtools/cli/warmup/) requests the pages of a site so that they are cached before visitors ask for them.
- **Logs**: [`azion logs`](/en/documentation/devtools/cli/logs/) prints the console logs of your functions and the HTTP event logs of your applications.
- **Frameworks**: projects built with Next.js, React, Vue, Angular, Astro, and other frameworks deploy through Azion Bundler. [Azion CLI guides and tutorials](/en/documentation/devtools/cli/guides/) carries one guide per framework, and [Frameworks compatibility](/en/documentation/devtools/runtime/frameworks/frameworks-compatibility/) describes how each framework runs on [Azion Runtime](/en/documentation/devtools/runtime/). To deploy a repository from Azion Console instead of the terminal, refer to [Import a project from GitHub](/en/documentation/guides/application-development/automation/import-an-existing-project-from-github/).
- **Help**: [Troubleshoot Azion CLI](/en/documentation/devtools/cli/troubleshooting/) lists the errors a command can return and how to fix each one, and the [Glossary](/en/documentation/devtools/cli/glossary/) defines the terms of the CLI.

---

## Next steps

- [Azion CLI quickstart](/en/documentation/devtools/cli/quickstart.md): Install the CLI and deploy your first function.
- [How Azion CLI works](/en/documentation/devtools/cli/how-it-works.md): Follow a project from its folder to a deployed workload.
- [Resource commands](/en/documentation/devtools/cli/resources.md): Manage a platform resource from the terminal.
- [Azion CLI guides and tutorials](/en/documentation/devtools/cli/guides.md): Deploy a framework project, or complete another task.
