You can add internal connections from an application’s Settings page or a database’s Info page. It doesn’t matter where you start the process; the result will be the same.
- If you’d like to add a connection from an application, use the Add connection button in the Internal connections section of the Settings page.
- If you’d like to add a connection from a database, use the Add application button in the Internal connections section of the Info page.
In both cases, you’ll see the same interface allowing you to select the database or application you’d like to create the internal connection to.
We can automatically populate an application’s environment variables from the database connection details. Do not copy and paste the internal connection details into environment variables. Click Add connection or Add application and select the Add environment variables… checkbox. This will automatically populate the environment variables from the database you’re connecting to.
Some applications may expect environment variables with different names. You can edit the names in the list before adding the connection or later on the application’s Settings page.
The port for internal connections to an application is 8080, and the port for internal connections to a database is 3306. The ports for these internal connections cannot be changed.
For applications, Kinsta automatically sets the
PORT environment variable. You do not need to define it yourself or hard-code it into the application. When an application is deployed, it is reachable on the internet on ports 80 and 443, and we route those ports to the container on port 8080.