Skip to content

Deploy the MySQL/MariaDB database template with OpenTofu

Deployment · Updated Jul 2026

Coming from another cloud?

▸AWS·RDS Mysql

This Quake AI feature maps to AWS’s RDS Mysql.

▸DigitalOcean·Managed DB

This Quake AI feature maps to DigitalOcean’s Managed DB.

▸Google Cloud·Cloud SQL Mysql

This Quake AI feature maps to Google Cloud’s Cloud SQL Mysql.

Deploy the MySQL/MariaDB database template with OpenTofu

Stand up MariaDB on a private subnet with a dedicated Cinder data volume using the validated OpenTofu template mysql-database. The database listens on a private address only; cloud-init formats the data volume at /var/lib/mysql and installs a scheduled mysqldump backup script.

Monthly cost estimate

Pricing calculator ↗

Sized as a custom package on dedicated vCPU.

Starting template$66.60/mo

Monthly total for the required template above. Use the configurator below to add optional pieces and see the total update.

What each resource is for

MySQL database

m2a.large · 2 dedicated vCPU, 8 GiB RAM, 0.5 Gbps

$66.00/mo

Compute shown per role at custom-package rates ($29/dedicated vCPU, $7.25/shared vCPU, $1/GiB RAM). The headline above is the billed total: the cheaper of a named plan and the custom package, plus add-ons.

Included in baseline

m2a.large

2 dedicated vCPU, 8 GiB RAM, 0.5 Gbps

$66.00

Compute + RAM rate basis

2 vCPU + 8 GiB RAM at $29/dedicated vCPU, $7.25/shared vCPU, $1/GiB RAM (regular). Totals apply the flat −$5/mo package promotion.

—

Block storage (70 GiB)

70 GiB at $0.08/GiB/mo

$5.60

Package promotional discount

Flat −$5.00/mo on the custom package (same promotion as named plans).

$-5.00

Included at no charge

These line items are zero on Quake AI. Many other providers meter them separately.

Data transfer (inbound and outbound)

Unlimited data transfer on every plan; Quake AI does not meter per-GB egress.

AWS, GCP, and Azure meter outbound transfer per GB. DigitalOcean and Hetzner include an allowance on compute plans, then charge overage.

Learn more
$0.00

Private networking

Private networks, subnets, Neutron routers, and security groups are included with the plan.

VPC objects are usually free to create elsewhere, but NAT gateways bill hourly plus per-GB processed. Quake AI uses router SNAT with no separate NAT line item.

$0.00

Control-plane API requests

OpenStack API calls for provisioning and management are included.

Some managed services on other clouds meter API calls or charge for premium control-plane features.

$0.00

Dev/test vs production

Start on shared CPU for dev/test, then promote to dedicated for production with a flavor resize. The network, storage, and template stay the same.

Dev/test on shared CPU

Burstable s1a flavors; suited to prototyping and low or bursty load.

$17.10/mo

Production on dedicated CPU

The headline estimate above; predictable steady-load performance.

$66.60/mo

Saves $49.50/mo while you build on shared CPU.

Shared flavors carry less RAM (m2a.large (8 GiB RAM) -> s1a.small (2 GiB RAM)). A resize reboots the instance; data on attached volumes persists. Size the dedicated flavor for the RAM your production workload needs.

Pricing data last validated: . For current rates, check quake.ai/pricing.

Quake AIRouterto PublicStaticPrivate network192.168.50.0/24Block volume50 GB/var/lib/mysqlSecurity groupSSH + MySQLmysqlMariaDBport 3306 /dev/sdb
Click to zoom
MySQL/MariaDB topology: private network, database instance on a dedicated data volume, router to PublicStatic, no floating IP

Prerequisites#

You need:

Step 1: Configure variables#

Copy terraform.tfvars.example to terraform.tfvars and set:

HCL
key_name      = "YOUR_KEY_NAME"
allowed_cidrs = ["192.168.50.0/24"]
db_password   = "CHOOSE_A_STRONG_PASSWORD"
VariablePurpose
key_nameExisting SSH key pair name Nova uses at boot
allowed_cidrsIPv4 ranges that may connect to MySQL/MariaDB on port 3306
db_passwordPassword cloud-init assigns to appuser

Defaults for flavor, volume size, engine package, and network CIDR are documented on the MySQL/MariaDB Database reference page.

Step 2: Apply the template#

From the template directory, run:

bash
tofu init
tofu plan
tofu apply

Type yes when prompted. Provisioning takes several minutes while Nova builds the boot volume, Cinder provisions the data volume, and cloud-init formats /dev/sdb and installs MariaDB.

When the run finishes, note private_ip from the outputs.

Step 3: Verify MySQL/MariaDB and the data volume#

Cloud-init can take a few more minutes after tofu apply returns. SSH to the instance private IP from a host that routes to the subnet:

bash
PRIVATE=$(tofu output -raw private_ip)
ssh -i ~/.ssh/YOUR_KEY ubuntu@${PRIVATE}

On the instance, confirm the data volume is mounted and MariaDB is running:

bash
df -h /var/lib/mysql
sudo systemctl is-active mariadb
sudo mysql -e "SHOW DATABASES;" | grep appdb

Connect as the application user and run a test query:

bash
mysql -h 127.0.0.1 -u appuser -p'CHOOSE_A_STRONG_PASSWORD' appdb -e "CREATE TABLE deploy_check (id INT); INSERT INTO deploy_check VALUES (1); SELECT * FROM deploy_check;"

The query returns one row, which confirms the database stores data on the attached volume.

Optional: confirm the backup cron:

bash
ls -l /usr/local/bin/mysql-backup.sh /etc/cron.d/mysql-backup

Next steps#

Clean up#

Run tofu destroy from the project directory when finished. Type yes to confirm. Verify in the Console that the instance and data volume are gone.

Was this page helpful?