Loading

Find connection details

Stack Serverless

To connect to your Elasticsearch deployment, you need either a Cloud ID or an Elasticsearch endpoint, depending on your deployment type. For secure connections, we recommend using an API key for authentication.

The following sections describe how to find your Cloud ID and create API keys in both Elastic Cloud and Serverless deployments.

  1. Go to the Elastic Cloud home page.

  2. In the main menu, select Manage this deployment.

    manage deployment
  3. The Cloud ID is displayed on the right side of the page.

    cloud id
  1. To navigate to API keys, use the global search bar.

    api keys search bar
  2. Select Create API key.

    click create api key
  3. Enter the API key details, and select Create API key.

  4. Copy and securely store the API key, since it won't appear again.

  1. Select the Help icon in the top right corner and then select Connection Details.

  2. Copy the Elasticsearch endpoint from the Endpoints tab.

    serverless connection details
Note

The Cloud ID is also available in the Connection Details section. Toggle the Show Cloud ID option to view it.

  1. Go to the serverless project’s home page.

  2. In the Connect to Elasticsearch section, select Create API key.

    serverless create an api key
  3. Enter the API key details, and select Create API key.

  4. Copy and securely store the API key, since it won't appear again.

Use curl to verify your connection to Elasticsearch.

In a terminal, assign the Elasticsearch endpoint and encoded API key to the ES_URL and API_KEY environment variables respectively. curl needs access to these values.

For example:

export ES_URL="https://dda7de7f1d264286a8fc9741c7741690.es.us-east-1.aws.elastic.cloud:443"
export API_KEY="ZFZRbF9Jb0JDMEoxaVhoR2pSa3Q6dExwdmJSaldRTHFXWEp4TFFlR19Hdw=="
		

Next, run the following command to test your connection:

curl "${ES_URL}" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json"
		

You should receive a response similar to the following:

{
  "name" : "serverless",
  "cluster_name" : "dda7de7f1d264286a8fc9741c7741690",
  "cluster_uuid" : "ws0IbTBUQfigmYAVMztkZQ",
  "version" : { ... },
  "tagline" : "You Know, for Search"
}
		

Now you’re ready to start adding data to your Elasticsearch Serverless project.