> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-ai/use-harness-platform/connectors/cloud-providers/pdc-connector.md).

# Add a Physical Data Center connector

Connect Harness to hosts in your physical data center for traditional deployments.

Use a Harness Physical Data Center (PDC) connector to connect Harness to the hosts in your physical data center. PDC connectors are typically used for traditional deployments, including [SSH](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/traditional/ssh-ng) and [WinRM](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/traditional/win-rm-tutorial) deployments.

***

## What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* How to [create a Physical Data Center connector](#create-a-physical-data-center-connector) using the Harness Manager.
* How to [create a Physical Data Center connector using the API](#create-a-physical-data-center-connector-using-the-api).
* How to [specify target hosts manually or using a JSON hosts file](#specify-target-hosts).
* How to define a Physical Data Center connector using a [YAML example](#yaml-examples).

***

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* **Target hosts**: The domain name or IP address of each host you want Harness to connect to, reachable from your Harness Delegate.
* **Harness Delegate**: A running Harness Delegate that can reach the target hosts. Go to [Delegate installation overview](/harness-ai/use-harness-platform/delegates/delegate/install-delegates/overview.md) to install one.

***

## Create a Physical Data Center connector <a href="#create-a-physical-data-center-connector" id="create-a-physical-data-center-connector"></a>

Perform the following steps to create the PDC connector using the Harness Manager. The connector wizard has four steps: **Overview**, **Details**, **Delegates Setup**, and **Test Connection**.

### Overview <a href="#overview" id="overview"></a>

1. In your project, org, or account, select **Connectors**, and then select **New Connector**.
2. Select **Physical Data Center**.
3. Enter a **Name** for the connector. Harness automatically creates an **Id** ([entity identifier](/harness-ai/use-harness-platform/references/entity-identifier-reference.md)) based on the **Name**.
4. Optionally, add a **Description** and **Tags**.
5. Select **Continue** to proceed to **Details**.

![Overview step of the Physical Data Center connector wizard](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-53358fdbd7cefd9357ca533616411ce054782168%2Fadd-pdc-connection.png?alt=media)

### Details <a href="#details" id="details"></a>

1. Select **Manually enter host names** or **Upload JSON file** to define your list of hosts. For details on both options, go to [Specify target hosts](#specify-target-hosts).
2. Select **Continue** to proceed to **Delegates Setup**.

![Details step of the Physical Data Center connector wizard](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-8688b5724cb0ec5c2c8e4a30b8f6f144da73dca8%2FAdd-PDC-connectordetails.png?alt=media)

### Delegates Setup <a href="#delegates-setup" id="delegates-setup"></a>

1. Select **Use any available Delegate**, or select **Only use Delegates with all of the following tags** and enter one or more delegate tags.
2. Select **Save and Continue** to proceed to **Test Connection**.

![Delegates Setup step of the Physical Data Center connector wizard](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-6ca8e115f041627a009e5c3a29c9f0954972b3b1%2Fadd-pdc-connectordelegates.png?alt=media)

### Test Connection <a href="#test-connection" id="test-connection"></a>

Harness validates connectivity to the PDC hosts. If verification succeeds, select **Finish**.

![Test Connection step of the Physical Data Center connector wizard](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-a2d1221953a0bc7c651725cde92282b0333ee421%2Fadd-pdc-testconnection.png?alt=media)

***

## Create a Physical Data Center connector using the API <a href="#create-a-physical-data-center-connector-using-the-api" id="create-a-physical-data-center-connector-using-the-api"></a>

Create the PDC connector using the [Create a Connector](https://apidocs.harness.io/tag/Connectors#operation/createConnector) API. The request sends the connector definition as YAML in the request body.

<details>

<summary>Create Connector API request</summary>

```bash
curl --location --request POST 'https://app.harness.io/gateway/ng/api/connectors?accountIdentifier=<YOUR_ACCOUNT_ID>' \
--header 'Content-Type: text/yaml' \
--header 'x-api-key: <YOUR_API_KEY>' \
--data-raw 'connector:
  name: PDC-Connector
  identifier: PDCConnector
  description: ""
  orgIdentifier: default
  projectIdentifier: CD_Docs
  type: Pdc
  spec:
    hosts:
      - hostname: ec2-54-111-26-183.us-west-2.compute.amazonaws.com
      - hostname: ec2-54-222-142-249.us-west-2.compute.amazonaws.com'
```

</details>

The request uses the following query parameter, headers, and body fields.

* **`accountIdentifier`** (query parameter, required): The identifier of the Harness account where the connector is created. Replace `<YOUR_ACCOUNT_ID>` with your account identifier.
* **`Content-Type`** (header, required): Set to `text/yaml` because the request body is YAML. Use `application/json` instead if you send the connector definition as JSON.
* **`x-api-key`** (header, required): A Harness API key with permission to create connectors in the target scope. Replace `<YOUR_API_KEY>` with your API key. For details on creating one, go to [Add and manage API keys](/harness-ai/use-harness-platform/automation/api/add-and-manage-api-keys.md).
* **`connector.name`**: The connector display name shown in the Harness UI.
* **`connector.identifier`**: A unique identifier for the connector. You cannot change the identifier after creation. For the identifier format, go to the [Entity Identifier reference](/harness-ai/use-harness-platform/references/entity-identifier-reference.md).
* **`connector.description`**: An optional description for the connector.
* **`connector.orgIdentifier`**: The identifier of the organization that owns the connector. Omit this field to create the connector at the account scope.
* **`connector.projectIdentifier`**: The identifier of the project that owns the connector. Omit this field to create the connector at the account or organization scope. A project-scoped connector requires `orgIdentifier` as well.
* **`connector.type`**: The connector type. Use `Pdc` for a Physical Data Center connector.
* **`connector.spec.hosts`**: The list of target hosts for the connector. Each entry sets `hostname` to the target host's domain name or IP address. To add hosts using a JSON hosts file instead of a static list, go to [Specify target hosts](#specify-target-hosts).

***

## Specify target hosts <a href="#specify-target-hosts" id="specify-target-hosts"></a>

Add target hosts to the connector manually or by uploading a JSON hosts file.

### Manually enter host names <a href="#manually-enter-host-names" id="manually-enter-host-names"></a>

To manually enter hosts in the connector, select **Manually enter host names**, and then add each host's domain name or IP address on a new line in the **Hosts** field.

### JSON hosts file <a href="#json-hosts-file" id="json-hosts-file"></a>

The following JSON hosts file defines two hosts, each with a set of host attributes.

```json
[
    {
        "hostname": "ec2-54-87-11-191.compute-1.amazonaws.com:5986",
        "hostAttributes": {
            "type": "node",
            "region": "east",
            "name": "node1",
            "ip": "54.87.11.191"
        }
    },
    {
        "hostname": "ec2-3-83-219-167.compute-1.amazonaws.com:5986",
        "hostAttributes": {
            "type": "db",
            "region": "east",
            "name": "node2",
            "ip": "3.83.219.167"
        }
    }
]
```

The `hostname` and `hostAttributes` properties are mandatory, and `hostAttributes` can have as many key-value pairs as you need.

When you select this PDC connector in an infrastructure definition, you can select **Filter by host name** or **Filter by host attributes** to select the hosts for deployment. Specify the host attributes as a comma-separated list of `attribute:value` pairs, for example, `region:west,type:node`.

![Filter hosts by attributes in an infrastructure definition](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-1736fc94f612d0768271a47c6bcff8964753d028%2F03f04039461392e58c2131391f278da95ea95e5c7d3c5e71e17913005342e9da.png?alt=media)

***

## YAML examples <a href="#yaml-examples" id="yaml-examples"></a>

The following YAML defines an account-scoped PDC connector with two target hosts, each with a set of host attributes.

<details>

<summary>PDC connector YAML</summary>

```yaml
connector:
  name: PDC-Connector # Connector display name shown in the Harness UI
  identifier: PDCConnector # Unique connector identifier, cannot be changed after creation
  description: "" # Optional description for the connector
  accountIdentifier: <YOUR_ACCOUNT_ID> # Harness account identifier that owns the connector
  type: Pdc
  spec:
    ignoreTestConnection: false # Set to true to skip the connection test for hosts that are unreachable when the connector is saved
    hosts:
      - hostname: ec2-54-88-193-136.compute-1.amazonaws.com:5986 # Target host domain name or IP address, plus port if required
        hostAttributes: # Optional key-value pairs used to filter hosts during deployment
          type: node
          region: east
          name: node1
          ip: 54.88.193.136
      - hostname: ec2-54-225-189-86.compute-1.amazonaws.com:5986
        hostAttributes:
          type: db
          region: east
          name: node2
          ip: 54.225.189.86
```

</details>

The `accountIdentifier` field scopes the connector to the account level. Omit `accountIdentifier` and add `orgIdentifier` and, optionally, `projectIdentifier` instead to scope the connector to an organization or project. By default, `ignoreTestConnection` is `false`, and Harness tests the connection to each host when you save the connector.

***

## Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>Test Connection fails with a socket connectivity error for every host</summary>

The **Test Connection** step fails with an error similar to the following, and the delegate task logs show an `UnknownHostException` for each line of the host list, including JSON syntax such as `{`, `}`, and property names:

```
Invalid request: Socket connectivity checks failed for host(s)
```

This happens when the contents of a JSON hosts file are pasted directly into the **Hosts** field on the **Details** step instead of being uploaded as a file. Harness treats each line of the pasted text as a separate hostname.

To fix this, go back to the **Details** step, clear the **Hosts** field, select **Upload JSON file**, and upload the JSON hosts file instead of pasting its contents.

If this error occurs for a host you entered correctly, the delegate cannot establish a socket connection to the host. If you do not specify a port with the host, Harness defaults to port 22.

* Verify the port is open on the host, and check the firewall rules between the delegate and the host.
* Test connectivity from the delegate to the host using `telnet <host> <port>`.

</details>

***

## Next steps <a href="#next-steps" id="next-steps"></a>

* [SSH deployments](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/traditional/ssh-ng): Deploy artifacts to hosts using SSH.
* [WinRM deployments](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/traditional/win-rm-tutorial): Deploy artifacts to Windows hosts using WinRM.

{% @harness-feedback/feedback module="harness-ai" pagePath="harness-ai/use-harness-platform/connectors/cloud-providers/pdc-connector" %}
