Azion CLI sync
Azion CLI command that synchronizes the azion.json file of a project with its resources on Azion, with every flag, its type, and its default.
The Azion CLI sync command synchronizes the local configuration file of a project, azion/azion.json, with the resources the project has on Azion. With --iac, it also writes an azion.config file that describes those resources as code. The options every command accepts, such as --format, --out, and -y, are on Global options.
Usage
Run azion sync in the folder of a project that has an azion folder:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--config-dir | — | string | "azion" | Relative path to the folder that holds your azion.json and args.json files. |
--env | — | string | ".edge/.env" | Relative path to your .env file. |
--extension | — | string | "mjs" | Extension of the azion.config file that --iac writes: mjs, cjs, ts, or js. |
--iac | — | — | — | Also writes an azion.config file that describes the resources of the project. |
Variables in the .env file whose names contain password, pwd, secret, key, hash, encrypted, passcode, auth, or token are sent to Azion as secrets.
Examples
Each example shows the command and the output it prints.
Synchronize a project
This command synchronizes a static site that was deployed with azion deploy:
The command prints one line for each stage:
For a site that has not changed since azion deploy, azion/azion.json keeps the same content.
Write the configuration as code
This command synchronizes the same site and writes its configuration to an azion.config file:
The command prints the name of the file it wrote:
The file azion.config.mjs holds the build settings of the site and its resources: the storage bucket, the application with its cache settings and rules, the connector, and the workload. azion/azion.json keeps the same content.
When the project already has an azion.config.cjs file, the command writes azion.config.mjs next to it. The next azion deploy --local then writes the storage prefix into the .mjs file.