Cloud

Assess Equinix Metal with cnspec

Query and assess Equinix Metal infrastructure with cnspec

Rely on cnspec to query and assess your Equinix Metal infrastructure, including organizations, projects, devices, SSH keys, and users.

Prerequisites

To analyze your Equinix Metal environment with cnspec, you must have:

Configure access to Equinix Metal

To create an API token:

  1. Log in to the Equinix Metal console.
  2. Navigate to your user settings.
  3. Generate an API token.

Connect to Equinix Metal

To query resources within an organization:

cnspec shell equinix org ORG_ID --token YOUR_API_TOKEN

To query resources within a specific project:

cnspec shell equinix project PROJECT_ID --token YOUR_API_TOKEN

You can also set the PACKET_AUTH_TOKEN environment variable instead of passing the --token flag:

export PACKET_AUTH_TOKEN=your_token_here
cnspec shell equinix org ORG_ID

Scan Equinix Metal

To scan your Equinix Metal organization:

cnspec scan equinix org ORG_ID --token YOUR_API_TOKEN

You can also create your own policies to meet your specific requirements.

Example queries

Retrieve organization information

cnspec> equinix.metal.organization

List projects

cnspec> equinix.metal.projects { name id createdAt }

List devices in a project

cnspec> equinix.metal.projects[0].devices { hostname state }

Retrieve device details

cnspec> equinix.metal.devices { hostname state billingCycle os }

List SSH keys

cnspec> equinix.metal.sshKeys

List users

cnspec> equinix.metal.users

Learn more

On this page