HashiCorp Cloud Platform
Access HCP Consul Dedicated clusters
After creating a HCP Consul Dedicated cluster, HCP provides both public and private URLs that you can use to access your cluster. You can also generate an admin token to access your cluster through the HTTP API or the Consul UI.
Get access URL
HCP provides the URL to access the Consul UI or make API calls to the Consul server. To access the URL, complete the following steps:
- Sign in to the HCP Portal.
- Select the organization or project where you created the cluster you want to access.
- Click Consul.
- From the Consul Overview, click the cluster ID you want to deploy clients with.
- Click Access Consul.
HCP Consul Dedicated has a URL for the public address and a URL for the private address. The public address allows access from any location over the public internet. The public address is most suitable for testing, development, and debugging scenarios. The private address limits access to connected networks. In production scenarios, we recommend using only the private address.
Generate admin token
To authenticate access to a HCP Consul Dedicated cluster, HCP provides an admin token that gives you the unlimited privileges for interacting with your cluster. You can use this token to access the Consul UI, deploying client agents with the Consul API, or interact with Consul using the CLI.
To generate the admin token, complete the following steps:
- Sign in to the HCP Portal.
- Select the organization or project where you created the cluster you want to access.
- Click Consul.
- From the Consul Overview, click the cluster ID you want to deploy clients with.
- Click Access Consul and then Generate admin token.
HCP provides an admin token that you can copy and use to access the Consul cluster. You cannot access the admin token again after closing the window that contains it. If you lose the admin token, you must generate a new one.
Connect to the Consul HTTP API
To connect to the HTTP API for a HCP Consul Dedicated cluster, export the URL and token:
$ export CONSUL_HTTP_ADDR=https://mycluster.consul.cc9a0090-3400-xxx-a3d2-xxx.aws.hashicorp.cloud && CONSUL_HTTP_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Next, run an API call to the desired endpoint. For example, the following command returns the trusted certificate authority (CA) root certificates for the HCP Consul Dedicated cluster.
$ curl --header "X-Consul-Token: ${CONSUL_HTTP_TOKEN}" ${CONSUL_HTTP_ADDR}/v1/agent/connect/ca/roots
View the Consul UI
You can use the HCP interface to view the cluster's built-in Consul UI. To view the UI, complete the following steps:
- Open the access URL in your browser.
- Click Log in.
- Paste the admin token and then click Log in.
The Consul UI appears. The default page lists the services deployed to the cluster.
For more information about navigating the Consul UI and using Consul features, refer to the Consul documentation.