Cloud Provider Selections with the SkySQL DBaaS API

Overview

This reference page details how to select cloud providers with the SkySQL DBaaS API for SkySQL.

SkySQL is available in regions worldwide on Amazon AWS and Google GCP.

Available Cloud Providers

Cloud provider choices are specific to the topology.

Provider

Description

aws

Amazon Web Services

gcp

Google Cloud Platform

REST Client

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

Query Options with REST Client

A REST client can query the SkySQL DBaaS API for the cloud provider selections.

To see the available cloud providers, use curl to call the /provisioning/v1/providers API endpoint:

$ curl -sS --location \
   --header "Authorization: Bearer ${SKYSQL_API_KEY}" \
   'https://api.mariadb.com/provisioning/v1/providers' \
   | jq .
[
  {
    "id": "305a4ea3-a85b-4707-a7f8-4f20dd3c4929",
    "name": "gcp",
    "display_name": "Google Cloud",
    "volume_size_min_gb": 8,
    "volume_size_max_gb": 2000
  },
  {
    "id": "5a9c1675-ca54-4b3b-9da9-2ea617e45969",
    "name": "aws",
    "display_name": "Amazon AWS",
    "volume_size_min_gb": 8,
    "volume_size_max_gb": 2000,
    "iops_per_gb": 1,
    "iops_min": 100
  }
]

For the cloud provider that you would like to select, extract the name attribute from the output and provide that value to the /provisioning/v1/services API endpoint as the provider attribute.

Select Option with REST Client

A cloud provider is selected during service launch. When using a REST client, select a cloud provider by calling the /provisioning/v1/services API endpoint with the provider 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-single",
  "provider": "gcp",
  "region": "us-central1",
  "architecture": "amd64",
  "size": "sky-2x8",
  "storage": 100,
  "nodes": 1,
  "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 cloud provider for a new service. When using Terraform, select a cloud provider using the provider attribute for the skysql_service resource:

# Create a service
resource "skysql_service" "default" {
  service_type        = "transactional"
  topology            = "es-single"
  cloud_provider      = "gcp"
  region              = "us-central1"
  architecture        = "amd64"
  size                = "sky-2x8"
  storage             = 100
  nodes               = 1
  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
}