DEV Community

Cover image for Mastering Elasticsearch with Alibaba Cloud: How to Create an Instance
A_Lucas
A_Lucas

Posted on

Mastering Elasticsearch with Alibaba Cloud: How to Create an Instance

Introduction

Alibaba Cloud Elasticsearch offers a powerful and flexible solution for managing and analyzing vast amounts of data in real-time. This tutorial will guide you through the process of creating an Elasticsearch instance, from understanding the prerequisites to executing API requests.

Prerequisites

Before delving into the technical details of creating an Elasticsearch instance, ensure that:

  • You are well-versed with the billing and pricing standards of Alibaba Cloud Elasticsearch. For more information, see Pricing of Alibaba Cloud Elasticsearch.
  • You have completed real-name verification.
  • You understand that you do not need to specify a zone when creating a cluster; by default, it is deployed in the same zone as the specified VPC.

Request Headers

The createInstance operation does not require operation-specific headers but uses common request headers. For more information, see Common Request Headers.

Request Syntax

The base syntax for creating an instance is as follows:

POST /openapi/instances HTTP/1.1
Enter fullscreen mode Exit fullscreen mode

Request Parameters

Below are some essential parameters you'll need for the request:

Parameter Type Required Description
clientToken String No Unique token to ensure idempotence of the request.
nodeAmount Integer Yes The number of data nodes. Valid values: 2 to 50.
instanceCategory String No Type of instance, e.g., advanced.
esAdminPassword String Yes Password for accessing the cluster, must be 8 to 32 characters long and include at least three types of characters.
esVersion String Yes Version of the Elasticsearch instance.
networkConfig NetworkConfig Yes The network configurations.
paymentType String No Billing method, either postpaid or prepaid.
description String No The name or description of the instance.
nodeSpec NodeSpec No Configurations of data nodes. Example: {"spec":"elasticsearch.sn2ne.xlarge", "disk":50, "diskType":"cloud_ssd"}.
warmNodeConfig WarmNodeConfig No Configurations of warm nodes.
kibanaConfig KibanaNodeConfig No Configurations of Kibana nodes' settings.

For a detailed list of parameters, refer to the Full API Documentation.

Example Request Body

Creating a General-purpose Business Edition Instance with Both Hot and Cold Nodes

{
  "description": "xpack-hot-cold",
  "nodeAmount": 2,
  "esVersion": "7.10_with_X-Pack",
  "instanceCategory": "x-pack",
  "nodeSpec": {
    "spec": "elasticsearch.sn2ne.xlarge",
    "disk": 20,
    "diskType": "cloud_ssd"
  },
  "warmNodeConfiguration": {
    "spec": "elasticsearch.sn1ne.xlarge",
    "amount": 3,
    "diskType": "cloud_efficiency",
    "disk": 500
  },
  "networkConfig": {
    "type": "vpc",
    "vpcId": "vpc-8vbfu74bmw4m7m84a****",
    "vswitchId": "vsw-8vbnk6cmurbpump2f****",
    "vsArea": "cn-zhangjiakou-c"
  },
  "paymentType": "postpaid",
  "esAdminPassword": "yourPassword",
  "kibanaConfiguration": {
    "spec": "elasticsearch.sn1ne.large"
  }
}
Enter fullscreen mode Exit fullscreen mode

Creating an Indexing Service Instance with Only Hot Nodes

{
  "description": "is-hot",
  "nodeAmount": 2,
  "esVersion": "7.10_with_X-Pack",
  "instanceCategory": "IS",
  "nodeSpec": {
    "spec": "elasticsearch.sn1ne.xlarge",
    "disk": 20,
    "diskType": "cloud_ssd"
  },
  "networkConfig": {
    "type": "vpc",
    "vpcId": "vpc-8vbfu74bmw4m7m84a****",
    "vswitchId": "vsw-8vbnk6cmurbpump2f****",
    "vsArea": "cn-zhangjiakou-c"
  },
  "paymentType": "postpaid",
  "esAdminPassword": "yourPassword",
  "kibanaConfiguration": {
    "spec": "elasticsearch.sn1ne.large"
  }
}
Enter fullscreen mode Exit fullscreen mode

Response Parameters

Upon successful execution, the response will include:

  • RequestId: A unique ID for the request.
  • Result.instanceId: The ID of the created Elasticsearch instance.

Sample Success Responses

XML Format

HTTP/1.1 200 OK
Content-Type:application/xml
<createInstanceResponse>
    <RequestId>838D9D11-8EEF-46D8-BF0D-BC8FC2B0C2F3</RequestId>

    <Result>
        <instanceId>es-is-0u2ecp69tt****</instanceId>

    </Result>

</createInstanceResponse>

Enter fullscreen mode Exit fullscreen mode

JSON Format

HTTP/1.1 200 OK
Content-Type:application/json
{
  "RequestId": "838D9D11-8EEF-46D8-BF0D-BC8FC2B0C2F3",
  "Result": {
    "instanceId": "es-is-0u2ecp69tt****"
  }
}
Enter fullscreen mode Exit fullscreen mode

Conclusion

Creating an Elasticsearch instance on Alibaba Cloud is a streamlined process, ensuring that you can efficiently manage and scale your data analytics capabilities. By following the guidelines and examples provided in this article, you should be well-equipped to get started.
Ready to start your journey with Elasticsearch on Alibaba Cloud? Explore our tailored Cloud solutions and services to take the first step towards transforming your data into a visual masterpiece.
Click here to embark on Your 30-Day Free Trial

Top comments (0)