database
A managed Postgres or MySQL database.
A database is a managed Postgres or MySQL server with one database on it, reachable only from inside the project's network. Its password is generated by the cloud and kept in the cloud's secret manager; it never appears in your file, in Ackee, or in a deploy log.
ackee 1project "shop" {cloud = "aws"region = "us-east-1"}service "web" {image = "public.ecr.aws/nginx/nginx:latest"port = 80size = "medium"}database "orders" {engine = "mysql"size = "medium"}connect env "web" -> "orders"
Fields
| Field | Takes | Meaning |
|---|---|---|
| engine | "postgres" | "mysql" default "postgres" | Which database server. Postgres 16 or MySQL 8.0. |
| size | "small" | "medium" | "large" default "small" | The instance class and storage — see sizes. Must be written out rather than referenced. |
Anything else — a specific instance class, a version, high availability — is a provider setting: declare the database with node and its exact type, which the error for an unknown field names for you.
Sizes
| size | AWS | Google Cloud | Azure |
|---|---|---|---|
small | db.t4g.micro, 20 GB | db-f1-micro | B_Standard_B1ms, 32 GB |
medium | db.t4g.small, 50 GB | db-g1-small | B_Standard_B2s, 64 GB |
large | db.t4g.medium, 100 GB | db-custom-2-7680 | GP_Standard_D2s_v3, 128 GB |
small is a development size on every cloud. Changing the size resizes the instance in place; the plan shows it as an update, not a replacement.
Connecting a service
A service reaches a database through an env connection, which hands the service everything it needs to connect as environment variables named after the database:
| Variable | Value |
|---|---|
ORDERS_HOST | the server's private address |
ORDERS_PORT | 5432 for Postgres, 3306 for MySQL |
ORDERS_NAME | the database's name |
ORDERS_USER | the user to connect as |
ORDERS_PASSWORD | read from the cloud's secret manager when the container starts |
The prefix is the database's name in upper case, with dashes as underscores: database "orders" gives ORDERS_. On AWS the connection also opens the database's firewall to that one service, and grants it permission to read the password.
What it becomes
AWS
An Amazon RDS instance with encrypted storage, no public address, its own security group and subnet group, and its password managed by RDS in AWS Secrets Manager.
Google Cloud
A Cloud SQL instance on a private IP only, peered into the project's network, with a generated password stored in Secret Manager. The password is written once and is never kept in Ackee's records of what it built.
Azure
An Azure Database flexible server in a delegated subnet of the project's network, with seven days of backups and a generated password stored in Key Vault.