Launch DB Using REST API
Launch a Service
1
4
Launch a Service
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,
"name": "skysql-quickstart",
"ssl_enabled": true,
"allow_list": [
{
"comment": "Describe the IP address",
"ip": "${SKYSQL_CLIENT_IP}/32"
}
]
}
EOFcurl -sS --location --request POST \
--header "X-API-Key: ${API_KEY}" \
--header "Accept: application/json" \
--header "Content-type: application/json" \
--data '@request-service.json' \
https://api.skysql.com/provisioning/v1/services \
| tee response-service.json | jq .$ export SKYSQL_SERVICE=`jq -r .id response-service.json`
5
6
Obtain Connection Details
export SKYSQL_FQDN=`jq -r .fqdn response-state.json`export SKYSQL_PORT=`jq '.endpoints[0].ports[] | select(.name=="readwrite") | .port' response-state.json`
curl -sS --location --request GET \
--header "X-API-Key: ${API_KEY}" \
--header "Accept: application/json" \
--header "Content-type: application/json" \
https://api.skysql.com/provisioning/v1/services/${SKYSQL_SERVICE}/security/credentials \
| tee response-credentials.json | jq .$ chmod 600 response-credentials.json$ export SKYSQL_USERNAME=`jq -r .username response-credentials.json` $ export SKYSQL_PASSWORD=`jq -r .password response-credentials.json`
7
Resources
Last updated
Was this helpful?

