Command Line Interface

The ZoneHero Command Line Interface (CLI) provides a convenient way to interact with ZoneHero regional API endpoints directly from your terminal. It allows you to perform operations such as retrieving load balancer information, which can be particularly useful for troubleshooting and support purposes.

Building and Installing the CLI

The ZoneHero CLI can be built from the same repository that is used to build the Terraform provider.

Prerequisites

  • Go >= 1.24
  • Make

Installation Steps

  1. Clone the repository:
git clone https://gitlab.guerraz.net/HLB/hlb-terraform-provider.git
  1. Build and install the CLI:
cd hlb-terraform-provider
make cli && make cli-install

This will compile the CLI and install it to your system, making the zonehero command available in your terminal.

Using the CLI

The ZoneHero CLI requires your AWS account credentials and an API key to authenticate with the ZoneHero API.

Basic Configuration

To use the CLI, you’ll need:

  1. An API Key (see API Keys)
  2. AWS credentials configured (either through environment variables, AWS CLI profiles, or IAM roles)

Command Syntax

The basic syntax for ZoneHero CLI commands is:

zonehero --api-key YOUR_API_KEY --profile AWS_PROFILE --region AWS_REGION COMMAND [OPTIONS]

Where:

  • YOUR_API_KEY is your ZoneHero API key
  • AWS_PROFILE is the AWS profile to use for credentials
  • AWS_REGION is the AWS region to target (e.g., eu-west-1)
  • COMMAND is the operation to perform (e.g., hlb get-load-balancer)
  • [OPTIONS] are command-specific options

Example: Retrieving Load Balancer Information

To retrieve detailed information about a specific load balancer:

zonehero --api-key UUID --profile AWS_PROFILE --region eu-west-1 hlb get-load-balancer --id LB_ID --output json

Replace:

  • UUID with your ZoneHero API key
  • AWS_PROFILE with your AWS profile name
  • LB_ID with the ID of the load balancer you want to inspect

The --output json flag formats the response as JSON, which is useful for further processing or when submitting support tickets.

Troubleshooting and Support

When submitting a support ticket regarding a particular HLB through the ZoneHero Support Portal, it is recommended to attach the output of the following command:

zonehero --api-key UUID --profile AWS_PROFILE --region eu-west-1 hlb get-load-balancer --id LB_ID --output json

This provides the support team with comprehensive information about your load balancer configuration, making it easier to diagnose and resolve issues.

Additional Commands

The ZoneHero CLI supports various commands for managing your load balancers. For a complete list of available commands and options, run:

zonehero --help

For help with a specific command, run:

zonehero COMMAND --help