Skip to content

metalcloud-cli subnet create

Create a new subnet

Create a new subnet in the MetalCloud infrastructure.

This command creates a subnet with the configuration provided through JSON input. The configuration must include required fields like network address, prefix length, and whether the subnet should be configured as an IP pool.

Required Flags: —config-source Source of the new subnet configuration. Can be ‘pipe’ to read from stdin, or a path to a JSON file containing the configuration.

Configuration Format: The JSON configuration should contain the following fields:

  • networkAddress (required): IP network address (e.g., “192.168.1.0”)
  • prefixLength (required): Network prefix length (e.g., 24)
  • isPool (required): Whether this subnet is an IP pool (true/false)
  • label (optional): Human-readable label for the subnet
  • name (optional): Subnet name
  • defaultGatewayAddress (optional): Gateway IP address
  • parentSubnetId (optional): ID of parent subnet
  • allocationDenylist (optional): List of IP ranges to exclude from allocation
  • childOverlapAllowRules (optional): Rules for allowing child subnet overlaps
  • tags (optional): Key-value pairs for tagging
  • annotations (optional): Additional metadata

Examples:

echo ’{“networkAddress”:“10.0.1.0”,“prefixLength”:24,“isPool”:false}’ | metalcloud-cli subnet create —config-source pipe

metalcloud-cli subnet create —config-source subnet-config.json

metalcloud-cli subnet config-example > example.json

metalcloud-cli subnet create —config-source example.json

metalcloud-cli subnet create [flags]
--config-source string Source of the new subnet configuration. Can be 'pipe' or path to a JSON file.
-h, --help help for create
-k, --api_key string MetalCloud API key
-c, --config string Config file path
-d, --debug Set to enable debug logging
-e, --endpoint string MetalCloud API endpoint
-f, --format string Output format. Supported values are 'text','csv','md','json','yaml'. (default "text")
-i, --insecure_skip_verify Set to allow insecure transport
-l, --log_file string Log file path
-v, --verbosity string Log level verbosity (default "INFO")

Auto generated by spf13/cobra on 11-Aug-2025

Section titled “Auto generated by spf13/cobra on 11-Aug-2025”