Manage targets with HCP Boundary
Targets are
Boundary resources that contain one or more host
sets. A
target allows Boundary users to define an endpoint with a default port and a
protocol to establish a session. Unless specified with a -host-id
flag,
Boundary will choose one
Host in the
host set to connect to at random.
This tutorial demonstrates the basics of how to define a host, host set, and a target in HCP Boundary on the CLI, the admin console, and using our Terraform provider.
Note
All resource IDs in this tutorial are illustrations only. IDs are uniquely generated for every resource upon creation. Be sure to use the resource IDs that are generated for your environment.
You will create a host catalog, a host set containing hosts, and a target.
Prerequisites
This tutorial assumes you have:
- Access to an HCP Boundary instance.
- Successfully completed the Manage Scopes tutorial.
- A publicly accessible Ubuntu instance.
- An ssh key-pair that can be used to authenticate with the Ubuntu instance.
Note
Ubuntu is used in this tutorial for demonstration purposes only. You can follow this guide to create a publicly accessible EC2 instance to use for this tutorial.
Add hosts to project
Hosts and host sets are defined within a host catalog. To get started, you will need to create the host catalog first.
To start this tutorial, be sure to Login to the Boundary Console first.
Create a host catalog named, "DevOps" with description, "For DevOps usage" in the
QA_Tests
project.Example output:
Copy the generated host catalog ID and save it as an environment variabe,
HOST_CATALOG_ID
.Example:
Now, create a new host named, "ubuntu" with description, "Ubuntu host" under the newly created host catalog. Enter in your Ubuntu instance's public IP address (such as
50.16.114.201
) in theaddress
field.Example output:
Create a host set
A host set groups together hosts. These hosts provide logically equivalent services.
Note
A target works off of host sets. Therefore, even if there is only one host, you still create a host set containing one host.
Create a host set named, "ubuntu-machines".
Example output:
Copy the
ubuntu-machines
host set ID and save it as an environment variable,HOST_SET_ID
.. In the example, the ID ishsst_X8gmzYXbO4
.Example:
Retrieve the host IDs.
In the example output, the
ubuntu
host ID ishst_U1qYKzKfXO
.Copy the generated host ID and create an environment variable called HOST_ID using copied value.
Add the
ubuntu
host to theubuntu-machines
host set.Example:
Define a target
Finally, create a target associated with the QA_Tests
project.
Create a target named, "tests" with description, "Test target". Set the default port to be
22
. To allow unlimited number of session connections, set the session connection limit to-1
.Example output:
In this example, the generated target ID is
ttcp_34yV5O9cwt
. Notice that target IDs starts withttcp_
.Copy the ID of the
tests
target and save it as an environment variable,TARGET_ID
.Example:
Add the
ubuntu-machines
host set to thetests
target.
Next steps
This tutorial demonstrated the steps to define targets under a scope
(QA_Tests
). Targets represent network services a user can connect to.
In the Manage Users and Groups
tutorial, you will add and manage users in the org
scope.