# Azion CLI deploy

Deploy your application onto Azion's edge network through Azion CLI.

:::note 
In case one or more required fields aren't informed through the specific flags, an interactive message prompts and asks for the missing information.
:::

## Usage

```bash
azion deploy
```

## Optional flags

#### path 

The `--path` option is used when it's necessary to inform the filepath to the static application being deployed.

#### help

The `--help` option displays more information about the `deploy` command.

#### auto

The `--auto` option runs the entire flow of the command without interruptions.

#### config-dir

The `--config-dir` option specifies the relative path to where your custom `azion.json` and `args.json` files are stored. The default is "azion".

#### dry-run

The `--dry-run` option simulates the deploy process without carrying out any actual action.

#### env

The `--env` option specifies the relative path to where your custom `.env` file is stored. The default is ".edge/.env".

#### no-prompt

The `--no-prompt` option, when sent, ensures that whenever the CLI would display an interactive prompt due to an error, it instead just returns the error.

#### skip-build

The `--skip-build` option, when sent, prevents the build command from being called during the deploy process.

#### skip-framework-build

The `--skip-framework-build` option, when sent, bypasses the framework build phase before executing the build command.

#### sync

The `--sync` option synchronizes the local `azion.json` file with remote resources.

#### local

The `--local` option allows to build and deploy locally. This may be useful if you have a custom build environment or need more control over the build stage.

#### debug

The `--debug` option allows you to see the logs of the deploying process directly on the terminal.

#### writable-bucket

The `--writable-bucket` option, when sent, creates the project bucket with read-write access.

#### workers

The `--workers` option allows you to manually configure the number of workers for the upload process. By default, the CLI automatically calculates the optimal number of workers based on your CPU cores (maximum of 20).

```bash
azion deploy --workers 5
```

:::note 
Once the deployment is triggered, Azion will open the browser and take you to a page on Azion Console where the deployment logs and process can be monitored. If it doesn't open automatically, just click on the provided link. Using the `--debug` flag will open the browser and display logs in the terminal as well.
:::

---

## Performance

The Azion CLI uses an optimized S3 upload engine for static file deployments, providing significant performance improvements:

- **Parallel uploads**: Files are uploaded concurrently using configurable workers.
- **Automatic worker calculation**: The CLI automatically determines the optimal number of workers based on CPU cores (max 20).
- **Improved upload times**: Medium-sized projects that previously took ~1m45s now deploy in approximately ~8 seconds.

You can fine-tune the upload performance using the `--workers` flag to match your specific environment and project needs.

---

## Credentials Management

The Azion CLI automatically manages S3 credentials for static application deployments. Credentials are stored securely in:

```
~/.azion/<PROFILE_NAME>/credentials.toml
```

No manual intervention is required. The CLI handles credential retrieval, storage, and rotation automatically during the deployment process.

---

## Observability

### Deploy Timing Summary

When running `azion deploy`, you'll receive a detailed timing report in the terminal showing the **Deploy Timing Summary**. This report includes:

| Phase | Description |
|-------|-------------|
| Upload | Time spent uploading static files to Object Storage |
| Bucket Creation | Time to create or configure the storage bucket |
| Manifest Apply | Time to apply the deployment manifest |
| Total | Overall deployment duration |

### Bundler Telemetry Report

The Azion Bundler generates detailed telemetry reports for build performance analysis. After building, you can find:

| File | Format | Description |
|------|--------|-------------|
| `.edge/telemetry-report.json` | JSON | Machine-readable telemetry data |
| `.edge/telemetry-report.html` | HTML | Visual timeline of build stages |

These reports help you identify bottlenecks and optimize your build configuration for faster deployments.