Skip to main content
  • Labs / 
  • Metal CLI

Metal CLI

The official Equinix Metal Command Line Interface.

Version v0.22.0 was released on 05 February, 2024 View changelog
Metal CLI

Equinix Metal provides an API-driven bare metal platform that combines the automation experience of the cloud with the benefits of physical, bare metal servers.

What is it?

Equinix Metal CLI is a command-line interface tool that allows users to manage their Equinix Metal resources from the command line. It is a powerful tool that enables developers to automate and streamline their workflows.

With the Equinix Metal CLI, users can create, delete, and manage Equinix Metal projects, devices, and even take advantage of more advanced networking options such as VRF support. This means users can interact with Metal Gateways, BGP Dynamic Neighbors, interconnections and related VLANs. Users can also use the CLI to retrieve information about their Equinix Metal resources, such as IP addresses, metadata, and usage statistics.

The Equinix Metal CLI is designed to be easy to use and flexible enough to be integrated into any workflow. It is available for download on the Equinix Metal website and can be installed on Windows, macOS, and Linux operating systems. This is the simplest way to interact with the Metal API. Users can output their information in different formats such as yaml, json, etc.

Why do we love it?

There are several benefits of using Equinix Metal CLI:

  • Time-Savings: Users can perform tasks quickly and efficiently from the command line.
  • Automation: The CLI allows users to automate their workflows, making it easier to manage Equinix Metal resources.
  • Flexibility: The Equinix Metal CLI is flexible and can be integrated into any workflow. Users can customize and script their workflows to suit their specific needs.
  • Efficiency: Using the CLI provides a more efficient way to manage Equinix Metal resources, reducing the risk of errors and making it easier to manage large environments.
  • Easy to use: The CLI employs a simple syntax that makes it easy to learn and use.
  • Versatile: Equinix Metal CLI can be used on multiple operating systems, including Windows, macOS, and Linux.

Overall, the Equinix Metal CLI makes it easier for developers to manage their Equinix Metal resources, saving time and increasing productivity.

Install Metal CLI

Follow the steps below to install and use Metal CLI.

Using Windows, OSX, or Linux

Download the latest release from the Metal CLI GitHub Releases page. See the Assets list beneath each release. The executable binary filenames include the OS and architecture. For example, to run Metal CLI on OSX with an M1 MacBook Pro you would use metal-darwin-arm64. With an earlier, Intel based model, you would use metal-darwin-amd64.

See the instructions at https://github.com/equinix/metal-cli?tab=readme-ov-file#installation for more details including PATH configuration.

Using Go

If you have Go installed, install Metal CLI from Go sources, by running:

go install github.com/equinix/metal-cli/cmd/metal@latest

Using Homebrew

Alternatively, you can install Metal CLI using Homebrew. Run the following commands:

brew tap equinix/homebrew-tap
brew install metal-cli

Authenticate

Before using Metal CLI, you need to authenticate with an Equinix Metal API key. You will choose your default organization and project during this step. By providing a default organization and project most commands will be simpler to use. Open $HOME/.config/equinix/metal.yaml to remove, change, or set additional command-line defaults.

metal init

Usage

The Metal CLI follows a consistent naming pattern with commands following top level API resources, such as organization, projects, devices, and vlans, followed by a sub-command like create, get, update, or delete.

Command names follow their corresponding API endpoint name, for convenience plural, singular, and common shortname aliases are generally available. The full argument names in each subcommand closely follow the naming of the corresponding API field. The most common arguments also have short names for convenience.

  • To fetch a project by ID: metal project get --id {UUID}
    • or use the -i shortname for the ID argument: metal project get -i {UUID}
  • To create a VLAN in Dallas: metal virtual-network create --vxlan 1000 --metro da
    • or use the vlan subcommand alias and VXLAN argument shortname: metal vlan create -v 1000 -m da

A few other example tasks for which you can use Metal CLI:

  • Specify new BGP Dynamic Neighbors by IP Range and ASN within a VRF
  • List your Metal Gateways
  • Get details on Server plan capacity per Metro
  • Create, update, or get details on said interconnections and their virtual-circuits

Run metal help and see https://deploy.equinix.com/developers/docs/metal/libraries/cli/ for a full list of the commands and arguments available.

By familiarizing yourself with the Metal CLI, you can quickly make modifications to your project resources without leaving your local console. Create a script that brings up your test project and another to tear it down when you are done.

While using the Metal CLI, you're building intuition about Equinix Metal servers and their networking components. Since the arguments are closely related to the API, this translates to Infrastructure as Code and SDK management of your projects.

Last updated

02 May, 2024

Category

Tagged

Applications
Subscribe to our newsletter

A monthly digest of the latest news, articles, and resources.