Documentation

esc
    Databases / Create a database

    Create a database

    Choose an engine, a version, a plan and where it lives, then follow the order until the database is ready.

    Before you start

    You need:

    • For the API, a write API key, in PANTECH_API_KEY.
    • Credit or a saved card: a database is paid for first, like a machine.
    • For a database in a VPC, the subnet it should live in. See VPCs and subnets.

    Then choose:

    Where it comes from
    engine and versionGET /database-engines: postgresql 18, mysql 8.4, and so on
    plan_slugGET /plans: sets vCPUs and memory, and the data disk's base size (disk_gb)
    storage_gbOptional. A bigger data disk than the plan's, in 10 GB steps up to 2,000 GB. See storage
    zone_idaf-abj-2 for a database in a VPC, with its subnet_id; af-abj-1 for one your standard VPSes reach over a private interface, with no subnet_id
    admin_usernameOptional. Defaults to dbadmin
    passwordOptional. Leave it out to have one generated and shown once

    In the console

    On Databases, press Create database, then fill in each section:

    1. Name and location: the name, and where it lives. Standard network puts it on the region's private database network, for your standard VPSes and the ranges you allow: nothing can reach it until you add an access rule. In a VPC puts it in a subnet you choose, and lets the VPC's own range in.
    2. Engine: PostgreSQL, MySQL or MariaDB, and the version.
    3. Size: the plan, which sets vCPUs, memory and the data disk's base size. Add more storage in steps; see storage.
    4. Network: for a database in a VPC, the VPC and the subnet.
    5. Admin login: the username (dbadmin unless you change it), and either Generate one for the password or I'll choose one (at least 16 characters).

    The summary shows the Upfront payment (40%), what it costs If it runs all month and If it’s stopped all month; see how billing works. They exclude VAT, and the upfront payment carries none. If the build fails, the upfront payment goes back to your credit balance, and if you delete the database later, the unused part does too. Press Create database.

    A generated password is shown once, under Save the admin password, with the username. We don't store it and support can't read it back: copy both, tick that you've saved them, then continue. If you lose it, reset it from the database's page.

    The database's page then follows the order until the database is running.

    With the API

    Terminal
    $ curl https://api.pantechdynamics.com/public/v1/databases \    -H "Authorization: Bearer $PANTECH_API_KEY" \    -H "Idempotency-Key: $(uuidgen)" \    -H "Content-Type: application/json" \    -d '{      "name": "orders-db",      "engine": "postgresql",      "version": "18",      "plan_slug": "starter",      "zone_id": "af-abj-2",      "subnet_id": "snet_…"    }'

    The answer is 202 Accepted with an order:

    JSON
    {
      "order_id": "ord_…",
      "database_id": "db_…",
      "status": "awaiting_payment",
      "amount_minor": 1059200,
      "currency": "NGN",
      "admin_username": "dbadmin",
      "password_returned": true,
      "password": "q8Vn3TzK1mXw7RbLc4Hs9JdP2fYa6GeU"
    }

    To choose the password yourself, send password (16 to 128 printable characters, no spaces, quotes or backslashes). It is then never returned.

    Other optional fields:

    • admin_username: the admin login's name, 3 to 32 lowercase letters, digits and underscores, starting with a letter. Reserved names are refused with INVALID_DATABASE_ADMIN_USERNAME: root, postgres, public, none, all, user, sys, system, replication, current_user, current_role, session_user, and any name starting with pg_, mysql, mariadb or pantech.
    • access_rules: the starting allow-list, as a list of CIDRs. Leave it out for the default (your VPC's whole range in af-abj-2, nothing in af-abj-1), or send [] for none. See access rules.
    • storage_gb: the data disk's size in GB, if you want more than the plan's disk_gb. Above the plan's size it must be a multiple of 10, up to 2,000. The upfront payment is priced for it. You can grow it later, but never shrink it.

    In af-abj-1

    Leave out subnet_id. The database starts with no access rules, so nothing can connect until you add one. The usual one is a VPS's private_network_ip as a /32, after you have given the VPS a private interface:

    Terminal
    $ curl https://api.pantechdynamics.com/public/v1/databases \    -H "Authorization: Bearer $PANTECH_API_KEY" \    -H "Idempotency-Key: $(uuidgen)" \    -H "Content-Type: application/json" \    -d '{      "name": "orders-db",      "engine": "mysql",      "version": "8.4",      "plan_slug": "starter",      "zone_id": "af-abj-1",      "storage_gb": 60,      "access_rules": ["10.250.4.23/32"]    }'

    Follow the order

    The order takes the payment, then builds the database. An order not paid within one hour expires (payment_failed, payment_expired) and nothing is built. Database orders explains each status and failure. Poll it every few seconds:

    Terminal
    $ curl https://api.pantechdynamics.com/public/v1/database-orders/ord_… \    -H "Authorization: Bearer $PANTECH_API_KEY"
    statusMeaning
    awaiting_paymentTaking the first payment, from credit or else your default card
    paidPaid; about to be built
    provisioningBeing built. operation_id is set, and you can follow it too
    provisionedReady: read the database
    payment_failedNot paid (failure_code says why: insufficient_credit, card_declined or payment_expired). Nothing was built
    failedPaid but not built. The payment goes back to your credit

    Then read the database for its hostname:

    Terminal
    $ curl https://api.pantechdynamics.com/public/v1/databases/db_… \    -H "Authorization: Bearer $PANTECH_API_KEY"

    When observed_state is running and hostname is set, connect to it.

    With the CLI

    pantech db create places the order, prints a generated password once, and waits until the database is running:

    Terminal
    $ pantech db create --name orders-db --engine postgresql --version 18 --plan starter \    --zone af-abj-2 --subnet web --storage-gb 100

    Pass --password-stdin to choose the password instead; it is read from a hidden prompt or a pipe, never from the command line. Leave out --storage-gb for the plan's own disk size. See the CLI for every db command.

    With Terraform

    In the provider's next release:

    HCL
    resource "pantechdynamics_database" "orders" {
      name       = "orders-db"
      engine     = "postgresql"
      version    = "18"
      plan_slug  = "starter"
      zone_id    = "af-abj-2"
      subnet_id  = pantechdynamics_subnet.data.id
      storage_gb = 100
    
      # Write-only: never saved in the plan or the state.
      password_wo         = var.orders_db_password
      password_wo_version = 1
    }

    The provider places the order, waits for it, and reads back hostname, port and private_ip. The password is a write-only attribute, so it never lands in your Terraform state. See Terraform.

    If it is refused

    The codes a create can return, field by field, are in database error codes.

    Was this page helpful?

    Updated