Node Count Selections with the SkySQL DBaaS API

Overview

This reference page details how to select a node count with the SkySQL DBaaS API for SkySQL.

Node count selection is supported for the Enterprise Server With Replica(s), Xpand Distributed SQL, and ColumnStore Data Warehouse topologies.

REST Client

A REST client can use the SkySQL DBaaS API to query node count selections and choose a node count for a new service.

Query Options with REST Client

A REST client can query the SkySQL DBaaS API for the node count selections for a specific topology.

To see the available node counts for a topology, use curl to call the /provisioning/v1/topologies/${TOPOLOGY}/nodes API endpoint:

$ curl -sS --location \
   --header "Authorization: Bearer ${SKYSQL_API_KEY}" \
   'https://api.mariadb.com/provisioning/v1/topologies/es-replica/nodes' \
   | jq .
[
    {
        "id": "a2e73d6a-ef2d-4643-8836-c42179bf55f8",
        "tier": "foundation",
        "topology": "es-replica",
        "nodes": [
            1,
            2,
            3,
            4,
            5
        ],
        "maxscale_nodes": [
            1,
            2
        ],
        "default_maxscale_nodes": 1
    }
]

The output can show different node counts, depending on whether your SkySQL account is Foundation tier or Power tier.

Select Option with REST Client

A hardware node count is selected during service launch. When using a REST client, select the number of nodes by calling the /provisioning/v1/services API endpoint with the nodes attribute set.

For example, prepare a request body containing the desired service options in a file called request-service.json:

$ cat > request-service.json <<EOF
{
  "service_type": "transactional",
  "topology": "es-replica",
  "provider": "gcp",
  "region": "us-central1",
  "architecture": "amd64",
  "size": "sky-2x8",
  "storage": 100,
  "nodes": 3,
  "version": "10.6.11-6-1",
  "name": "skysql-nr-quickstart",
  "ssl_enabled": true
}
EOF

Then use curl to call the /provisioning/v1/services API endpoint to create (launch) a new database service and save the response to the response-service.json file:

$ curl -sS --location --request POST \
   --header "Authorization: Bearer ${SKYSQL_API_KEY}" \
   --header "Accept: application/json" \
   --header "Content-type: application/json" \
   --data '@request-service.json' \
   https://api.mariadb.com/provisioning/v1/services \
   | tee response-service.json | jq .

Upon success, the command will return JSON with details about the new service.

Terraform

Terraform can use the SkySQL Terraform provider to choose a node count for a new service. When using Terraform, select the number of nodes using the nodes attribute for the skysql_service resource:

# Create a service
resource "skysql_service" "default" {
  service_type        = "transactional"
  topology            = "es-replica"
  cloud_provider      = "gcp"
  region              = "us-central1"
  architecture        = "amd64"
  size                = "sky-2x8"
  storage             = 100
  nodes               = 3
  version             = "10.6.11-6-1"
  name                = "skysql-nr-quickstart"
  ssl_enabled         = true
  deletion_protection = true
  wait_for_creation   = true
  wait_for_deletion   = true
  wait_for_update     = true
  is_active           = true
}