---
title: "Create a direct-connect host-group"
diataxis: reference
applies_to:
  product: "nirmata-control-hub"
audience: ["platform-engineer","developer"]
last_updated: 2026-03-25
url: https://docs.nirmata.io/docs/reference/rest-api/sample_operations/create_direct_connect_hostgroup/
---

Steps-1: Find DC Cloud Credentials ID

 Request:

    curl -k -H "Authorization: NIRMATA-API <key>" "https://nirmata.io/config/api/cloudProviders?filter=type,equals,Other&fields=id,name,type,modelIndex"

Response:

    {
        "id" : "a41f0493-f6e0-45d6-b56b-41ab93d9d392",
        "modelIndex" : "CloudProvider",
        "type" : "Other",
        "name" : "Direct Connect"
    }



Step-2: Create a DC Host Group


Request:

    curl -k -H "Authorization: NIRMATA-API <key>" "https://nirmata.io/config/api/cloudProviders/a41f0493-f6e0-45d6-b56b-41ab93d9d392/hostGroups" -H "Content-Type: application/json" -d "{\"name\" : \"test-dchg\"}"


Response:
  ```

  "id" : "05e788fe-d03d-470c-beaa-6be342af8232",
  "service" : "Config",
  "modelIndex" : "HostGroup",
  "uri" : "/config/api/hostGroups/05e788fe-d03d-470c-beaa-6be342af8232",
  "tenantId" : "2bc8ddd6-071a-4199-8774-417e59562f97",
  "parent" : {
    "id" : "29536aea-4ace-4b04-9639-3677e708b786",
    "service" : "Config",
    "modelIndex" : "CloudProvider",
    "uri" : "/config/api/cloudProviders/29536aea-4ace-4b04-9639-3677e708b786",
    "childRelation" : "hostGroups"
  },
  "createdBy" : "anubhav@nirmata.com",
  "createdOn" : 1585678177977,
  "modifiedBy" : "anubhav@nirmata.com",
  "modifiedOn" : 1585678177977,
  "generation" : 0,
  "ancestors" : [ {
    "service" : "Config",
    "modelIndex" : "CloudProvider",
    "uuid" : "29536aea-4ace-4b04-9639-3677e708b786"
  }, {
    "service" : "Config",
    "modelIndex" : "Root",
    "uuid" : "2b39ae84-5a16-4711-a398-910891aa3c61"
  } ],
  "labels" : {
    "nirmata.io/hostgroup.name" : "test-dchg"
  },
  "additionalProperties" : { },
  "alarms" : [ ],
  "name" : "test-dchg",
  "action" : null,
  "desiredCount" : 1,
  "status" : [ ],
  "serviceState" : null,
  "state" : null,
  "minHosts" : 0,
  "maxHosts" : 5,
  "orchestrator" : null,
  "cluster" : null,
  "isClusterManaged" : null,
  "labels" : null,
  "isAutoscalable" : null,
  "hosts" : [ ],
  "vSphereConfig" : [ ],
  "openStackConfig" : [ ],
  "vCloudConfig" : [ ],
  "azureConfig" : [ ],
  "awsConfig" : [ ],
  "googleComputeConfig" : [ ],
  "hostGroupStats" : [ ],
  "actions" : [ ],
  "resourceSelectionRules" : [ ]
    
```text

Step-3: Attach Nodes to the Host Group

Get the Host Group ID from the response to the create. Then run this command on each node:

Request:
```bash
sudo curl -sSL https://nirmata.io/nirmata-host-agent/setup-nirmata-agent.sh | sudo sh -s -- --cloud other --hostgroup <HOST GROUP ID>
```text
 

