A managed database is a PostgreSQL, MySQL or Redis instance that LayerOne provisions, secures with TLS, and backs up for you. It runs on one of your private networks with no public address, and apps in the same project can attach to it. Find them under the Databases tab of the Application platform.
This page covers using a database with an application. For the full reference on connecting, backups, resizing and cost, see Deploy a managed database.
Create one
- On the Databases tab, select New database.
- Choose the Engine: PostgreSQL, MySQL or Redis. Each shows its version and starting memory.
- Set a Name, choose a Private network, and set a Private address inside that network's range.
- Create it. It is ready in a minute or two, with its name, user, password and certificate generated for you.
Attach it to an app
Instead of copying a connection string into a variable, attach the database so its credentials are injected at boot and follow a password rotation on their own.
- Open the application's Variables tab and attach the database. It must be in the same project as the app.
- Map the database's connection fields (
url,host,port,username,password,database) to your own variable names, so the app sees them under whatever names its code expects, for exampleDATABASE_URL. - Deploy the app to pick up the attachment.
Detaching a database leaves its data in place; it just stops injecting the credentials.
TLS is on by default
A managed database requires an encrypted connection unless you deliberately
turn that off. Use sslmode=require for PostgreSQL, --ssl-mode=REQUIRED for
MySQL, or a rediss:// URL for Redis. The database page has the exact
connection details and a downloadable certificate.