Updated on 2024-10-30 GMT+08:00

Creating an Instance

Function

  • This API can be used to create an instance.
  • The API can be used to create an instance when you restore data using a specific backup.
  • The API can also be used to create an instance when you restore data of a specific instance to a specified point in time.

Constraints

This API supports the following types of instances:

  • GeminiDB Cassandra
  • GeminiDB Mongo
  • GeminiDB Influx
  • GeminiDB Redis

This API supports both yearly/monthly and pay-per-use instances.

Only GeminiDB Cassandra and GeminiDB Influx allow you to restore data of a specified time point from a specified cluster instance to a new one.

URI

POST https://{Endpoint}/v3/{project_id}/instances

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Instance name, which can be the same as an existing instance name.

The name must start with a letter and can include 4 to 64 characters. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).

datastore

Yes

Datastore object

Database information.

region

Yes

String

Region ID.

The value cannot be empty. For value details, see Regions and Endpoints.

availability_zone

Yes

String

AZ ID.

For details about the value, see az_status returned in Querying Instance Specifications. If an instance can be created across three AZs, separate multiple AZ IDs by commas (,).

vpc_id

Yes

String

VPC ID. You can obtain the value with either of the following methods:

  • Method 1: Log in to the VPC console and view the VPC ID on the VPC details page.
  • Method 2: Query the VPC ID using the VPC API. For details, see Querying VPCs.

subnet_id

Yes

String

Subnet ID. You can obtain the subnet ID with either of the following methods:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
  • Method 2: Query the subnet ID using the VPC API. For details, see Querying Subnets.

security_group_id

Yes

String

Security group ID. You can obtain the security group ID with either of the following methods:

  • Method 1: Log in to the VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page.
  • Method 2: Query the security group using the VPC API. For details, see Querying Security Groups.

password

Yes

String

Database password.

The password can include 8 to 32 characters and contain uppercase letters, lowercase letters, digits, and the following special characters: ~!@#%^*-_=+? The password of GeminiDB Redis instances can contain at least two types of the following characters: uppercase letters, lowercase letters, digits, and special characters (~!@#$%^&*()-_=+?).

Enter a strong password against security risks such as brute force cracking.

mode

Yes

String

Instance type. The value can be:

  • Cluster, indicating that GeminiDB Cassandra supports the cluster type.
  • ReplicaSet, indicating that GeminiDB Mongo 4.0 supports the replica set type.
  • Cluster, indicating that GeminiDB Influx supports the cluster type.
  • InfluxdbSingle, indicating that GeminiDB Influx supports the single-node instance type.
  • Cluster, indicating that GeminiDB Redis supports the cluster type.
  • Replication, indicating that GeminiDB Redis supports the primary/standby type.

flavor

Yes

Array of Flavor objects

Instance specifications.

For details about the specifications, see parameter values under flavors in Querying Instance Specifications.

configuration_id

No

String

Parameter template ID.

backup_strategy

No

BackupStrategy object

Advanced backup policy.

enterprise_project_id

No

String

Enterprise project ID.

  • Do not transfer this parameter if EPS is not enabled.
  • If EPS is enabled but this parameter is not transferred, the default enterprise project is used. For the enterprise project ID, see the id value in the enterprise_project field data structure table in section "Querying the Enterprise Project List" of the Enterprise Project Management Service API Reference.

ssl_option

No

String

Whether SSL is enabled.

The value can be:

  • 0, indicating that SSL is disabled by default.
  • 1, indicating that SSL is enabled by default.
  • If this parameter is not transferred, SSL is disabled by default.

charge_info

No

ChargeInfo object

Billing mode, which includes yearly/monthly and pay-per-use. The default billing mode is pay-per-use.

dedicated_resource_id

No

String

Dedicated resource ID. This parameter can be delivered only after the dedicated resource pool is enabled.

restore_info

No

RestoreInfo object

Backup information. You can restore data from a specific backup or instance to a specific point in time during the backup retention period.

Only GeminiDB Cassandra and GeminiDB Influx allow you to restore data from a specific cluster instance to a specific point in time.

port

No

String

Port number for accessing the instance.

You can specify a port number for accessing GeminiDB Redis instances. The port number ranges from 1024 to 65535, excluding 2180, 2887, 3887, 6377, 6378, 6380, 8018, 8079, 8091, 8479, 8484, 8999, 9864, 9866, 9867, 12017, 12333, and 50069.

If you do not specify a port number, port 6379 is used by default when you create a GeminiDB Redis instance.

If you want to use this instance for dual-active DR, set the port to 8635.

availability_zone_detail

No

object

Multi-AZ details of the active/standby instance

Currently, only GeminiDB Redis instances are supported.

The system ignores this parameter if single-AZ deployment is selected. For details, see Table 9.

Table 4 Datastore

Parameter

Mandatory

Type

Description

type

Yes

String

Database type.

  • GeminiDB Cassandra, GeminiDB Mongo, GeminiDB Influx, and GeminiDB Redis instances are supported.
  • If you set this parameter to cassandra, GeminiDB Cassandra instances will be created.
  • If you set this parameter to mongodb, GeminiDB Mongo instances will be created.
  • If you set this parameter to influxdb, GeminiDB Influx instances will be created.
  • If you set this parameter to redis, GeminiDB Redis instances will be created.

version

Yes

String

Database version. The value can be:

  • 3.11, indicating that GeminiDB Cassandra 3.11 is supported.
  • 4.0, indicating that GeminiDB Mongo 4.0 is supported.
  • 1.7, indicating that GeminiDB Influx 1.7 is supported.
  • 5.0, indicating that GeminiDB Redis 5.0 is supported.

storage_engine

Yes

String

Storage engine.

  • rocksDB, indicating that the GeminiDB Cassandra instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Mongo instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Influx instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Redis instance supports the RocksDB storage engine.
Table 5 Flavor

Parameter

Mandatory

Type

Description

num

Yes

String

Number of nodes.

  • Each GeminiDB Cassandra instance can contain 3 to 60 nodes.
  • Each GeminiDB Mongo replica set 4.0 can contain 3 nodes.
  • Each GeminiDB Influx cluster instance can contain 3 to 16 nodes.
  • Each GeminiDB Influx single-node instance can contain 1 node.
  • Each GeminiDB Redis instance can contain 3 to 12 nodes.

size

Yes

String

Storage space. It must be an integer, in GB.

For GeminiDB Cassandra, GeminiDB Mongo, and GeminiDB Influx instances, the minimum storage space is 100 GB, and the maximum limit depends on instance specifications. The maximum and minimum storage space of a GeminiDB Redis instance depends on node quantity and specifications of the instance.

storage

Yes

String

Disk type.

If you set this parameter to ULTRAHIGH, SSD disks are used.

spec_code

Yes

String

Resource specification code.

For the code, see the value of response parameter spec_code in Querying Instance Specifications.

Table 6 BackupStrategy

Parameter

Mandatory

Type

Description

start_time

Yes

String

Backup time window. Automated backup will be triggered during the backup time window.

The value cannot be empty. It must be the UTC time in the hh:mm-HH:MM format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00, 15, 30, or 45.
  • If this parameter is not transferred, the default backup time window is from 00:00 to 01:00.
  • Example value: 23:00–00:00

keep_days

No

String

Backup retention days.

The value ranges from 0 to 35.

  • If this parameter is set to 0, the automated backup policy is not set.
  • If this parameter is not transferred, the automated backup policy is enabled by default. Backup files are stored for 7 days by default.
Table 7 ChargeInfo

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Billing mode.

Values:

  • prePaid: indicates that the billing mode is yearly/monthly.
  • postPaid: indicates that the billing mode is pay-per-use.

period_type

No

String

Subscription period type.

Values:

  • month: indicates that the subscription unit is month.
  • year: indicates that the subscription unit is year.
NOTE:

This parameter is valid and mandatory only when charge_mode is set to prePaid.

period_num

No

String

Subscription time period. This parameter is available and mandatory only when charge_mode is set to prePaid.

Values:

  • If period_type is set to month, the parameter value ranges from 1 to 9.
  • If period_type is set to year, the parameter value ranges from 1 to 3.

is_auto_renew

No

String

Whether automatic renewal is enabled for yearly/monthly instances. The renewal period is the same as the original period, and the order will be automatically paid during the renewal. The value can be:

  • true, indicating that the subscription is automatically renewed.
  • false, indicating that the subscription is not automatically renewed. The default value is false.

is_auto_pay

No

String

Payment method. When you create a yearly/monthly instance, you can specify whether the order is automatically paid from your account. This parameter does not affect the payment mode of automatic renewal. The value can be:

  • true, indicating that the order is automatically paid from your account.
  • false, indicating that the order needs to be manually paid from your account. This payment method is used by default.
Table 8 RestoreInfo

Parameter

Mandatory

Type

Description

backup_id

No

String

Full backup file ID.

This parameter cannot be left blank when you create an instance to restore data using a specific backup.

source_instance_id

No

String

ID of the specified instance that backup data is restored to.

This parameter cannot be left blank when you restore data at a specific point in time from a specific instance to a new instance.

restore_time

No

Long

Time point that backup data is restored to.

This parameter cannot be left blank when you restore data at a specific point in time from a specific instance to a new instance. The value is a 13-digit number (in milliseconds, UTC time). You can query the value by referring to Querying the Time Window When a Backup Can Be Restored.

Table 9 AvailabilityZoneDetail

Parameter

Mandatory

Type

Description

primary_availability_zone

Yes

String

The primary AZ must be a single AZ and be different from the standby AZ.

secondary_availability_zone

Yes

String

The standby AZ must be a single AZ and be different from the primary AZ.

Response Parameters

Status code: 202

Table 10 Response body parameters

Parameter

Type

Description

id

String

Instance ID.

name

String

Instance name. This parameter is the same as the corresponding request parameter.

datastore

Datastore object

Database information. This parameter is the same as the corresponding request parameter.

created

String

Creation time, which is in the yyyy-mm-dd hh:mm:ss format.

status

String

Instance status. The value is creating.

region

String

Region ID. This parameter is the same as the corresponding request parameter.

availability_zone

String

AZ ID. This parameter is the same as the corresponding request parameter.

vpc_id

String

VPC ID. This parameter is the same as the corresponding request parameter.

subnet_id

String

Subnet ID. This parameter is the same as the corresponding request parameter.

security_group_id

String

Security group ID. This parameter is the same as the corresponding request parameter.

mode

String

Instance type. This parameter is the same as the corresponding request parameter.

flavor

Array of Flavor objects

Instance specifications. This parameter is the same as the corresponding request parameter.

backup_strategy

BackupStrategy object

Advanced backup policy. This parameter is the same as the corresponding request parameter.

enterprise_project_id

String

Enterprise project ID. If you set this parameter to 0, the resource belongs to the default enterprise project.

ssl_option

String

Whether SSL is enabled. This parameter has the same effect as the corresponding request parameter.

job_id

String

ID of the workflow for creating an instance. This parameter is returned only when a pay-per-use instance is created.

order_id

String

ID of the order for creating an instance. This parameter is returned only when you create a yearly/monthly instance.

charge_info

ChargeInfo object

Billing mode, which includes yearly/monthly and pay-per-use. The default billing mode is pay-per-use.

dedicated_resource_id

String

Dedicated resource ID. This parameter is returned only when the DB instance belongs to a dedicated resource pool.

Table 11 Datastore

Parameter

Type

Description

type

String

Database type.

  • GeminiDB Cassandra, GeminiDB Mongo, GeminiDB Influx, and GeminiDB Redis instances are supported.
  • If you set this parameter to cassandra, GeminiDB Cassandra instances will be created.
  • If you set this parameter to mongodb, GeminiDB Mongo instances will be created.
  • If you set this parameter to influxdb, GeminiDB Influx instances will be created.
  • If you set this parameter to redis, GeminiDB Redis instances will be created.

version

String

Database version. The value can be:

  • 3.11, indicating that GeminiDB Cassandra 3.11 is supported.
  • 4.0, indicating that GeminiDB Mongo 4.0 is supported.
  • 1.7, indicating that GeminiDB Influx 1.7 is supported.
  • 5.0, indicating that GeminiDB Redis 5.0 is supported.

storage_engine

String

Storage engine.

  • rocksDB, indicating that the GeminiDB Cassandra instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Mongo instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Influx instance supports the RocksDB storage engine.
  • rocksDB, indicating that the GeminiDB Redis instance supports the RocksDB storage engine.
Table 12 Flavor

Parameter

Type

Description

num

String

Number of nodes.

  • Each GeminiDB Cassandra instance can contain 3 to 60 nodes.
  • Each GeminiDB Mongo replica set 4.0 can contain 3 nodes.
  • Each GeminiDB Influx instance can contain 3 to 16 nodes.
  • Each GeminiDB Redis instance can contain 3 to 12 nodes.

size

String

Storage space. It must be an integer, in GB.

ForGeminiDB Cassandra, GeminiDB Mongo, and GeminiDB Influx instances, the minimum storage space is 100 GB, and the maximum limit depends on instance specifications. The maximum and minimum storage space of a GeminiDB Redis instance depends on node quantity and specifications of the instance.

storage

String

Disk type.

If you set this parameter to ULTRAHIGH, SSD disks are used.

spec_code

String

Resource specification code.

For the code, see the value of response parameter spec_code in Querying Instance Specifications.

Table 13 BackupStrategy

Parameter

Type

Description

start_time

String

Backup time window. Automated backup will be triggered during the backup time window.

The value cannot be empty. It must be the UTC time in the hh:mm-HH:MM format.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to 00, 15, 30, or 45.
  • If this parameter is not transferred, the default backup time window is from 00:00 to 01:00.
  • Example value: 23:00–00:00

keep_days

String

Backup retention days.

The value ranges from 0 to 35.

  • If this parameter is set to 0, the automated backup policy is not set.
  • If this parameter is not transferred, the automated backup policy is enabled by default. Backup files are stored for 7 days by default.
Table 14 ChargeInfo

Parameter

Type

Description

charge_mode

String

Billing mode.

Values:

  • prePaid: indicates that the billing mode is yearly/monthly.
  • postPaid: indicates that the billing mode is pay-per-use.

period_type

String

Subscription period type.

Values:

  • month: indicates that the subscription unit is month.
  • year: indicates that the subscription unit is year.
NOTE:

This parameter is valid and mandatory only when charge_mode is set to prePaid.

period_num

String

Subscription time period. This parameter is available and mandatory only when charge_mode is set to prePaid.

Values:

  • If period_type is set to month, the parameter value ranges from 1 to 9.
  • If period_type is set to year, the parameter value ranges from 1 to 3.

is_auto_renew

String

Whether automatic renewal is enabled for yearly/monthly instances. The renewal period is the same as the original period, and the order will be automatically paid during the renewal. The value can be:

  • true, indicating that the subscription is automatically renewed.
  • false, indicating that the subscription is not automatically renewed. The default value is false.

is_auto_pay

String

Payment method. When you create a yearly/monthly instance, you can specify whether the order is automatically paid from your account. This parameter does not affect the payment mode of automatic renewal. The value can be:

  • true, indicating that the order is automatically paid from your account.
  • false, indicating that the order needs to be manually paid from your account. This payment method is used by default.

Example Requests

  • URI example
    POST https://{Endpoint}/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances
  • Creating a pay-per-use 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory

    Values of region and availability_zone in the request body are only examples. Set them based on service requirements.

    {
      "name" : "test-cassandra-01",
      "datastore" : {
        "type" : "cassandra",
        "version" : "3.11",
        "storage_engine" : "rocksDB"
      },
      "region" : "aaa",
      "availability_zone" : "bbb",
      "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961",
      "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007",
      "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58",
      "password" : "******",
      "mode" : "Cluster",
      "flavor" : [ {
        "num" : 3,
        "storage" : "ULTRAHIGH",
        "size" : 500,
        "spec_code" : "geminidb.cassandra.4xlarge.4"
      } ],
      "backup_strategy" : {
        "start_time" : "08:15-09:15",
        "keep_days" : 8
      },
      "ssl_option" : 1
    }
  • Creating a yearly/monthly 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory

    Values of region and availability_zone in the request body are only examples. Set them based on service requirements.

    {
      "name" : "test-cassandra-01",
      "datastore" : {
        "type" : "cassandra",
        "version" : "3.11",
        "storage_engine" : "rocksDB"
      },
      "region" : "aaa",
      "availability_zone" : "bbb",
      "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961",
      "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007",
      "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58",
      "password" : "******",
      "mode" : "Cluster",
      "flavor" : [ {
        "num" : 3,
        "storage" : "ULTRAHIGH",
        "size" : 500,
        "spec_code" : "geminidb.cassandra.4xlarge.4"
      } ],
      "backup_strategy" : {
        "start_time" : "08:15-09:15",
        "keep_days" : 8
      },
      "ssl_option" : 1,
      "charge_info" : {
        "charge_mode" : "prePaid",
        "period_type" : "year",
        "period_num" : 3,
        "is_auto_renew" : true,
        "is_auto_pay" : true
      }
    }
  • Creating a pay-per-use 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory based on data restored using a specific backup

    Values of region and availability_zone in the request body are only examples. Set them based on service requirements.

    { 
       "name" : "test-cassandra-01", 
       "datastore" : { 
         "type" : "cassandra", 
         "version" : "3.11", 
         "storage_engine" : "rocksDB" 
       }, 
       "region" : "aaa", 
       "availability_zone" : "bbb", 
       "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961", 
       "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007", 
       "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58", 
       "password" : "******", 
       "mode" : "Cluster", 
       "flavor" : [ { 
         "num" : 3, 
         "storage" : "ULTRAHIGH", 
         "size" : 500, 
         "spec_code" : "geminidb.cassandra.4xlarge.4" 
       } ], 
       "backup_strategy" : { 
         "start_time" : "08:15-09:15", 
         "keep_days" : 8 
       }, 
       "ssl_option" : 1, 
       "restore_info" : { 
         "backup_id" : "2f4ddb93b9014b0893d81d2e472f30fe"
       } 
     }
  • Creating a yearly/monthly 3-node GeminiDB Cassandra instance with 16 vCPUs and 64 GB of memory based on the data of a specified instance at a specified point in time

    Values of region and availability_zone in the request body are only examples. Set them based on service requirements.

    { 
       "name" : "test-cassandra-01", 
       "datastore" : { 
         "type" : "cassandra", 
         "version" : "3.11", 
         "storage_engine" : "rocksDB" 
       }, 
       "region" : "aaa", 
       "availability_zone" : "bbb", 
       "vpc_id" : "674e9b42-cd8d-4d25-a2e6-5abcc565b961", 
       "subnet_id" : "f1df08c5-71d1-406a-aff0-de435a51007", 
       "security_group_id" : "7aa51dbf-5b63-40db-9724-dad3c4828b58", 
       "password" : "******", 
       "mode" : "Cluster", 
       "flavor" : [ { 
         "num" : 3, 
         "storage" : "ULTRAHIGH", 
         "size" : 500, 
         "spec_code" : "geminidb.cassandra.4xlarge.4" 
       } ], 
       "backup_strategy" : { 
         "start_time" : "08:15-09:15", 
         "keep_days" : 8 
       }, 
       "ssl_option" : 1, 
       "charge_info" : { 
         "charge_mode" : "prePaid", 
         "period_type" : "year", 
         "period_num" : 3, 
         "is_auto_renew" : true, 
         "is_auto_pay" : true 
       }, 
       "restore_info" : { 
         "restore_time" : 1607731200000, 
         "source_instance_id" : "054e292c9880d4992f02c0196d3ein12" 
       } 
     }

Example Responses

Status code: 202

Accepted

Creating a pay-per-use instance:

{
  "id" : "39b6a1a278844ac48119d86512e0000bin06",
  "name" : "test-cassandra-01",
  "datastore" : {
    "type" : "cassandra",
    "version" : "3.11",
    "storage_engine" : "rocksDB"
  },
  "created" : "2019-10-28 14:10:54",
  "status" : "creating",
  "region" : "aaa",
  "availability_zone" : "bbb,ccc,ddd",
  "vpc_id" : "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
  "subnet_id" : "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
  "security_group_id" : "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
  "mode" : "Cluster",
  "flavor" : [ {
    "num" : 3,
    "size" : 500,
    "storage" : "ULTRAHIGH",
    "spec_code" : "geminidb.cassandra.4xlarge.4"
  } ],
  "backup_strategy" : {
    "start_time" : "08:15-09:15",
    "keep_days" : "8"
  },
  "ssl_option" : "1",
  "job_id" : "c010abd0-48cf-4fa8-8cbc-090f093eaa2f"
}

Creating a yearly/monthly instance:

{
  "id" : "39b6a1a278844ac48119d86512e0000bin06",
  "name" : "test-cassandra-01",
  "datastore" : {
    "type" : "cassandra",
    "version" : "3.11",
    "storage_engine" : "rocksDB"
  },
  "created" : "2019-10-28 14:10:54",
  "status" : "creating",
  "region" : "aaa",
  "availability_zone" : "bbb,ccc,ddd",
  "vpc_id" : "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
  "subnet_id" : "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
  "security_group_id" : "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
  "mode" : "Cluster",
  "flavor" : [ {
    "num" : 3,
    "size" : 500,
    "storage" : "ULTRAHIGH",
    "spec_code" : "geminidb.cassandra.4xlarge.4"
  } ],
  "backup_strategy" : {
    "start_time" : "08:15-09:15",
    "keep_days" : "8"
  },
  "enterprise_project_id" : "0",
  "ssl_option" : "1",
  "charge_info" : {
    "charge_mode" : "prePaid",
    "period_type" : "year",
    "period_num" : 3,
    "is_auto_renew" : true,
    "is_auto_pay" : true
  }
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.