For the complete documentation index, see llms.txt. This page is also available as Markdown.

Command Structure

This guide introduces the basic structure and syntax of Zenlayer Cloud CLI commands.

Command Structure Overview

Zenlayer Cloud CLI uses a multi-level command format with the following basic structure:

zeno [global-options] <command> [subcommand] [parameters]

Component Description

  • Global Options: Options that apply to all commands, such as --profile, --output, etc.

  • Command: Corresponds to a Zenlayer Cloud service, such as zec (Elastic Compute), etc.

  • Subcommand: Corresponds to a specific operation of the service, such as describe-instances, create-zec-instances, etc.

  • Parameters: Specific parameters for the command, such as --instance-id, --instance-type, etc.

Command Examples

Example 1: List All Cloud Server Instances

zeno zec describe-instances

Example 2: List Cloud Server Instances Using a Specific Profile

zeno --profile prod zec describe-instances

Example 3: Create a Cloud Server Instance

Example 4: Use JSON Output Format

Command Hierarchy

The Zenlayer Cloud CLI command hierarchy is as follows:

  1. Root Command: zeno

  2. Service Commands: such as zec, etc.

  3. Operation Commands: such as describe-instances, create-zec-instances, etc.

Command Hierarchy Example

Global Options

Zenlayer Cloud CLI supports the following global options:

Option
Shorthand
Description

--profile

-p

Specifies the profile to use

--output

-o

Specifies the output format (json or table)

--query

-q

Filters output using JMESPath queries

--access-key-id

Specifies the Access Key ID

--access-key-secret

Specifies the Access Key Secret

--debug

Enables debug mode

--help

-h

Displays help information

Command Naming Conventions

Zenlayer Cloud CLI command naming follows these conventions:

  • Service Commands: Use service abbreviations, such as zec (Elastic Compute), etc.

  • Operation Commands: Use verb+noun format, such as describe-instances, create-zec-instances, etc.

  • Parameters: Use lowercase letters and hyphens, such as --instance-id, --instance-type, etc.

Command Execution Flow

When you execute a Zenlayer Cloud CLI command, the following flow occurs:

  1. The CLI parses the command and parameters

  2. Loads configuration (from configuration files or environment variables)

  3. Validates credentials

  4. Builds the API request

  5. Sends the request to the Zenlayer Cloud API

  6. Processes the response

  7. Outputs the result in the specified format

Command Best Practices

  • Use Help: Use the --help option to get detailed information about commands

  • Use Auto-Completion: Set up command auto-completion to improve input efficiency

  • Use Profiles: Create profiles for different environments for easy switching

  • Use Output Formats: Choose the appropriate output format based on your needs

  • Use Query Filtering: Use the --query option to filter output and get only the information you need

FAQ

Command Not Found

If you get a "command not found" error when running a command, check:

  • Whether the CLI is properly installed

  • Whether the command is spelled correctly

  • Whether the service supports the command

Parameter Errors

If you encounter parameter errors, check:

  • Whether the parameter name is correct

  • Whether the parameter value meets requirements

  • Whether required parameters are missing

Last updated

Was this helpful?