2020-09-24 10:14:25 -07:00
---
layout: docs
2024-12-04 13:30:49 -05:00
page_title: Connect to a target
description: >-
Understand how to connect to targets using HCP Boundary. Learn how to select targets and use your choice of client and connect helpers to facilitate connections.
2020-09-24 10:14:25 -07:00
---
2023-05-26 13:11:43 -04:00
# Connect to your first target
2020-09-25 09:40:34 -07:00
2022-06-22 00:37:49 -06:00
The [Quick setup
2023-01-20 18:17:34 -05:00
wizard](/boundary/docs/getting-started/deploy-and-login#login-to-hcp-boundary)
2022-06-22 00:37:49 -06:00
is the fastest way to onboard a target to HCP Boundary.
2020-09-25 09:40:34 -07:00
2023-02-14 12:47:06 -05:00

2022-06-22 00:37:49 -06:00
2025-03-24 11:55:30 -05:00
The Quick setup wizard creates a default `tcp` target with the address `127.0.0.1` and the port `22` (the default SSH port using TCP).
2023-02-14 12:47:06 -05:00
When you execute `boundary connect` against this target, Boundary establishes a local, authenticated proxy to the address on the target's default port (`127.0.0.1:22`.)
2022-06-22 00:37:49 -06:00

2022-10-28 12:49:36 -06:00
## Connect using the CLI
2022-10-05 09:24:21 -06:00
To connect to the initial EC2 Instances target:
2022-06-22 00:37:49 -06:00
2022-10-05 09:24:21 -06:00
1. Copy the **EC2 Instances** target ID (such as `ttcp_ZnHEU9h8qX`).
2022-06-22 00:37:49 -06:00
2022-10-05 09:24:21 -06:00
1. Open a terminal session. Export the Boundary **Cluster URL** as an environment
2022-06-22 00:37:49 -06:00
variable.
2025-03-24 11:55:30 -05:00
```shell-session
$ export BOUNDARY_ADDR=<boundary-cluster-url>
```
2022-06-22 00:37:49 -06:00
1. Connect to the target.
2025-03-24 11:55:30 -05:00
```shell-session
$ boundary connect -target-id ttcp_eTcZMueUYv
```
2020-09-25 20:14:18 -04:00
2025-03-24 11:55:30 -05:00
The output displays the address and port that your SSH client must use.
2021-03-03 13:29:17 -05:00
2022-03-10 11:26:48 -07:00
The `boundary connect` command has a number of notable options, such as
`-listen-port` to choose the port on which the connect command will listen for
an incoming connection. This is convenient for allowing Boundary to work with
applications that allow you to select the connection address, but not the port.
2025-03-24 11:55:30 -05:00
For some applications there are still some extra hurdles that can exist, which
2022-03-10 11:26:48 -07:00
is why connect helpers can be useful.
2021-03-03 13:29:17 -05:00
The dev-mode default target allows you to make as many connections as you want
2025-03-24 11:55:30 -05:00
within the authorized session. When you finish making connections, a
`Ctrl-C/Command-C` to the `boundary connect` process shuts down the session.
2021-03-03 13:29:17 -05:00
2023-07-07 14:42:11 -04:00
## Select targets
2020-12-14 16:52:11 -05:00
2025-03-24 11:55:30 -05:00
When you use `boundary connect`, you must identify the target used for connecting.
The convention in this documentation is to use the target ID because it refers to a
single explicit value.
Other supported flags include:
2020-12-14 16:52:11 -05:00
- `target-name`: The name of the target
- `target-scope-id`: The ID of the scope in which the target lives
- `target-scope-name`: The name of the scope in which the target lives
2025-03-24 11:55:30 -05:00
Note however that these other flags are not uniquely identifying, as you may reuse names
across scopes. Therefore, if you don't use the target ID, you must use the target's name in conjunction with the scope name or scope ID so that Boundary can identify the correct target.
2020-12-14 16:52:11 -05:00
2022-03-10 11:26:48 -07:00
Here is an SSH example in dev-mode:
2022-06-22 00:37:49 -06:00
```shell-session
2022-03-10 11:26:48 -07:00
$ boundary connect ssh -target-name "Generated target" -target-scope-name "Generated project scope"
```
2023-12-13 13:58:10 -05:00
## Connect helpers
2025-03-24 11:55:30 -05:00
Connect helpers automatically accept host SSH key prompts for you.
The connect helper format is `boundary connect <subcommand>`.
Boundary includes connect helpers for the following connection types:
2023-12-13 13:58:10 -05:00
- HTTP
- Kubernetes
- PostgreSQL
- RDP
- SSH
Refer to the [Connect helpers](/boundary/docs/concepts/connection-workflows/connect-helpers) documentation for more information.
2025-03-24 11:55:30 -05:00
## Exec flag
2020-09-25 09:40:34 -07:00
2023-12-13 13:58:10 -05:00
In addition to the built-in connect helpers, `boundary connect`
2023-07-21 12:12:55 -07:00
can accommodate executing clients even when there is no built-in support
2025-03-24 11:55:30 -05:00
for a specific client using `-exec`. The `-exec` flag is a powerful
2023-07-21 12:12:55 -07:00
tool, allowing you to wrap Boundary TCP sessions in your preferred
2020-09-25 20:14:18 -04:00
client. You can use this flag to create an authenticated proxy to almost
anything.
2020-09-25 09:40:34 -07:00
2023-12-13 13:58:10 -05:00
Refer to the [Exec flag](/boundary/docs/concepts/connection-workflows/exec-flag) documentation for more information.
2021-04-14 17:35:07 -04:00
2023-12-13 13:58:10 -05:00
## SSH ProxyCommand
2021-04-14 17:35:07 -04:00
2023-12-13 13:58:10 -05:00
SSH `ProxyCommand` lets you proxy an SSH connection to a target according to a configuration file that you create.
It can help simplify common developer and operator workflows.
You can configure the file to connect to the target ID or the target domain.
2020-09-25 09:40:34 -07:00
2023-12-13 13:58:10 -05:00
Refer to the [SSH ProxyCommand](/boundary/docs/concepts/connection-workflows/workflow-ssh-proxycommand) documentation for more information.
2020-10-08 11:27:30 -07:00
2023-12-13 13:58:10 -05:00
## Desktop client
2021-02-18 14:12:51 -05:00
2025-03-24 11:55:30 -05:00
While you use the desktop client, choose the target and connect to retrieve local
2022-03-10 11:26:48 -07:00
proxy details.
2021-02-18 14:12:51 -05:00
<video
muted
playsInline
autoPlay
loop
2022-06-22 00:37:49 -06:00
className="boundary-clickthrough-video boundary-clickthrough-desktop-video"
2021-02-18 14:12:51 -05:00
>
<source
type="video/mp4"
src="https://www.datocms-assets.com/2885/1613612836-boundary-desktop-clickthrough-connect-target-v1-0-0.mp4"
/>
</video>
2022-07-12 12:29:35 -07:00
## Tutorial
2023-01-20 18:17:34 -05:00
Refer to the [Connect to your First Target](/boundary/tutorials/hcp-getting-started/hcp-getting-started-connect) tutorial for steps on how to create a host catalog, host set, and a target in Boundary.
2022-07-12 12:29:35 -07:00
2023-07-07 14:42:11 -04:00
## Next steps
2020-10-08 11:27:30 -07:00
2025-03-24 11:55:30 -05:00
Refer to the [basic administration
2023-01-20 18:17:34 -05:00
workflows](/boundary/tutorials/hcp-administration) tutorial series
2023-12-13 13:58:10 -05:00
for in depth discussions on managing scopes, targets, identities, and sessions.