When you provision a Database on Aptible, you'll be provided with a set of Database Credentials.
Database Credentials are available in the Dashboard. Click Reveal to show them.
Database Credentials are presented as connection URLs. A large number of libraries can use those directly, but you can always break down the URL in components.
The structure is:
protocol://username:[email protected]:port/name ═══╦════ ═══╦════ ═══╦════ ═╦══ ═╦══ ═╦══ ║ ║ ║ ║ ║ ╚╡► Database-dependent ║ ║ ║ ║ ╚═════╡► Port number ║ ║ ║ ╚══════════╡► Hostname ║ ║ ╚═════════════════╡► Password ║ ╚══════════════════════════╡► Username ╚═════════════════════════════════════╡► Database-dependent
The password in Database Credentials should be protected for security.
There are three ways to connect to a database using Database Credentials:
This set of credentials is usable with Network Integrations, and is also how Apps, other Databases, and Ephemeral SSH Sessions within the Stack can contact the Database. The credentials can be retrieved through
aptible db:url and the Dashboard.
Database Endpoints allows users to expose Aptible Databases on the public internet. When a Database Endpoint is created, a separate set of Database Credentials is provided. Database Endpoints are useful if, for example, a third party needs to be granted access to the Aptible Database. This set of Database Credentials can be found in the Dashboard.
aptible db:tunnel CLI command allows users to create a Database Tunnel which provides a convenient, ad-hoc method for users to connect to Aptible Databases from a local workstation. Database Credentials are exposed in the terminal when you successfully tunnel and are only valid while the
db:tunnel is up. Database Tunnels persist until the connection is closed or for a maximum of 24 hours.
The Database Credentials provides credentials for the
aptibleuser, but you can also create your own users for database types that support multiple users such as PostgreSQL and MySQL. Refer to the database's own documentation for detailed instructions. If setting up a restricted user, refer to Aptible's community topic for extra considerations.
Updated 3 months ago