Skip to content

Connect with cloud database

This guide will help you establish a connection to your cloud database. By default, cloud databases are isolated within their own namespace, making them inaccessible from other namespaces or external sources. This isolation is a security measure designed to protect your data as much as possible.

Setup connection

To setup a database connection from your container you need the connection information of your database cluster.

  1. Choose your database
  2. Navigate to users
  3. Click on the eye icon of the desired user
  4. In the modal you will see all relevant information to create a connection to the database

Note

If you are new to our api we recommend reading the automation article about our api first.

You can use the query below to get the connection information for your database cluster.

query MyQuery {
    cloudDatabaseCluster(
        cloudDatabase: {name: "demo-cluster", namespace: "demo"}
    ) {
        hostname
        users {
        name
        dsn
        }
    }
    cloudDatabaseClusterUserCredentials(
        cloudDatabase: {name: "demo-cluster", namespace: "demo"}
        username: "demo_app_user"
    ) {
        password
    }
}

Once you have obtained the necessary information, you can configure your container or container job. We strongly recommend using environment variables and secrets to configure your container, as this ensures that your password is stored securely and decouples your container image from specific credentials.

External connections

If you need an external connection to your database you can request a shared or dedicated IP.

Shared IP

The working of a shared IP is we provide an IPv4 and IPv6 address to you which is shared among multiple customers. We define the external port and connect it to the default port of your database.

The shared IP option comes with no costs

  1. Create or edit the database

    Create a new database, or open the overview tab of an existing database in the Nexaa portal.

  2. Enable External Connections

    Click on "Enable External Connections".

  3. Add an external connection

    In the wizard, configure the external connection.

    1. Select Shared IP and click Next
    2. You can restrict access by specifying allowed IP-addresses in the IP Allow list section (remember to add your IPv6 address as well if you have one). If left blank, the database will be accessible from anywhere in the world (0.0.0.0/0, ::/0).
    3. You get an overview. Click Enable to add the external connection

    The database saves and updates automatically.

Important

Once saved, Nexaa will generate a random port number for your external connection. Your database will become available at this port number and the Nexaa shared IP-address. You can find the IP-address and port number in the overview tab of your database. Here you can also edit or remove the external connection.

Dedicated IP

The dedicated IP option is the same as the shared IP with some small differences. You will get an IPv4 and IPv6 address which is allocated specially for you. You can use these IP's to connect to any of your containers, databases or message queues. No other customers can make use of these IP-addresses You can also choose yourself which external port is connected to which container port, database or message queue.

This option is the right option when you need to decide which external port on the IP-address is connected to your database.

The dedicated IP option comes with extra costs

No dedicated IP yet?

A dedicated IP-address is assigned to your account on request. If your account does not have one yet, the Dedicated IP option in the wizard is marked On request at extra cost and the button reads Submit request. Fill in the request form and we will get in touch to set up the dedicated IP. As soon as it is assigned to your account, you can add and manage dedicated IP external connections yourself using the steps below.

  1. Create or edit the database

    Create a new database, or open the overview tab of an existing database in the Nexaa portal.

  2. Enable External Connections

    Click on "Enable External Connections".

  3. Add an external connection

    In the wizard, select Dedicated IP and click Next. The Add external connection dialog opens.

    1. External port: type the port number on your dedicated IP-address that should be connected to the default port of your database (e.g. 15432) and press ENTER
    2. IP Allow list: you can restrict access by specifying allowed IP-addresses (remember to add your IPv6 address as well if you have one). If left blank, the database will be accessible from anywhere in the world (0.0.0.0/0, ::/0).
    3. Click Add to add the external connection

    The database saves and updates automatically.

Important

Once saved, your database will become available at the external port you chose on your dedicated IPv4 and IPv6 address. The external connection is listed in the overview tab of your database with connection type Dedicated IP, the external port and the IP allow list. Here you can also edit or remove the external connection.

Manage external connections

The external connection (shared IP or dedicated IP) of a database is listed in a table in the overview tab of the database. The row shows the connection type (Shared IP or Dedicated IP), the external port and the IP allow list.

  • Edit: click the pencil icon of the row. The same dialog as when adding the connection opens with the current configuration. Change the IP allow list and click Save.
  • Remove: click the cross icon of the row and confirm in the Remove external connection dialog.

The database saves and updates automatically.

Changing the external port

The external port of an existing dedicated IP external connection cannot be edited. The External port field in the edit dialog is disabled. To move your database to a different external port, remove the external connection and add a new one with the new external port.