deck ai sync

Uses: deck
Related Documentation
Related Resources

The deck ai sync command reads AI Gateway configuration files and configures the target AI Gateway to match the values specified in your declarative configuration. It tags every managed entity with managed_by:deck-ai.

This is the direct equivalent of running deck file ai2kong followed by deck gateway sync on the result.

Any configuration in AI Gateway that isn’t present in the provided declarative configuration file will be deleted using deck ai sync. To apply a partial configuration use tags.

The deck ai sync command can accept one or more files as positional arguments:

# Sync a single file
deck ai sync kong.yaml

In addition to positional arguments, deck ai sync can read input from stdin for use in pipelines:

# Remove example-service from the file before syncing
cat kong.yaml | yq 'del(.services[] | select(.name == "example-service"))' | deck ai sync

Syncing multiple files

Syncing multiple files at once causes decK to merge all of the provided files in to a single configuration before syncing. To split your configuration in to independent units, use tags.

decK can construct a state by combining multiple JSON or YAML files inside a directory instead of a single file.

In most use cases, a single file will suffice, but you might want to use multiple files if:

  • You want to organize the files for each Service. In this case, you can have one file per Service, and keep the Service, its associated Routes, Plugins, and other entities in that file.
  • You have a large configuration file and want to break it down into smaller digestible chunks.
# Sync multiple files
deck ai sync services.yaml consumers.yaml
# Sync a whole directory
deck ai sync directory/*.yaml

Command usage

Usage:
  deck ai sync [flags] [ai-gateway-state-files...]

Flags:
  -h, --help               help for sync
      --json-output        generate command execution report in a JSON format.
      --parallelism int    Maximum number of concurrent operations. (default 10)
  -w, --workspace string   Sync configuration to a specific workspace (Kong Enterprise only).
                           This takes precedence over _workspace fields in state files.
      --yes yes            assume yes to prompts and run non-interactively.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!