Introduction / API / Oxide

oxide api /v1/instances?project=myproj --method POST --input - << EOF
{
  "name": "myinstance2",
  "description": "my second Oxide instance",
  "hostname": "myinst2",
  "memory": 4294967296,
  "ncpus": 2,
  "disks": [
    {
      "type": "create",
      "name": "ubuntu-disk",
      "description": "from a project image",
      "size": 4294967296,
      "disk_backend": {
        "type": "distributed",
        "disk_source": {
          "type": "image",
          "image_id": "$(oxide api '/v1/images/ubuntu-customized?project=myproj' | jq -r .id)"
        }
      }
    },
    {
      "type": "create",
      "name": "additional-disk",
      "description": "blank disk for data storage",
      "size": 21474836480,
      "disk_backend": {
        "type": "distributed",
        "disk_source": {
          "type": "blank",
          "block_size": 4096
        }
      }
    }
  ],
  "network_interfaces": {
    "type": "default_ipv4"
  },
  "external_ips": [
    {
      "type": "ephemeral",
      "pool_selector": {
        "ip_version": "v4",
        "type": "auto"
      }
    }
  ],
  "start": true
}
EOF