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 a Container, database or message queue

    Create a container, database, or message queue. For existing services, in the Nexaa portal go to the configure tab of the container, or the overview tab of the database or message queue.

  2. Expose the container port (only necessary for containers)

    You need to expose a port for container traffic; this should be the port on which the container is listening (e.g. 3306:3306).

  3. Enable External Connections (only necessary for containers)

    1. For containers:
      • Toggle the setting “Make this container accessible from the internet?” to enable
      • Go to the External Connections tab
      • Click on "Enable External Connections"
    2. For databases and message queues:
      • Click on "Enable External Connections".
  4. Add an external connection

    In the wizzard, configure the external connection.

    1. Select Shared IP and click Next
    2. for containers:
      • Select the port which you exposed in the previous step (e.g. 3306)
      • Select the protocol (TCP, UDP or both). In most cases just TCP is enough
    3. for containers, databases and message queues:
      • You can restrict access by specifying allowed IP-adresses in the IP Allow list section (remember to add your IPv6 address as well if you have one)
      • If left blank, the container, database or message queue will be accessible from anywhere in the world.
    4. You get an overview. Click "Enable" to add the external connection
  5. Save

    Make sure to click Update Container to apply the new configuration to your container. Databases and message queues will save and update automatically.

Important

Once saved, Nexaa will generate a random port number for your external connection. Your service 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 of your container, database or message queue. Here you can also edit the external connection configuration if needed.

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 can connect to which container port, database or message queue.

This option is the right option when you need to decide which external port needs to be connected to the container port.

The dedicated IP option comes with extra costs

  1. Create or Edit a Container, database or message queue

    Create a container, database, or message queue. For existing services, in the Nexaa portal go to the configure tab of the container, or the overview tab of the database or message queue.

  2. Expose the container port (only necessary for containers)

    You need to expose a port for container traffic; this should be the port on which the container is listening (e.g. 3306:3306).

  3. Enable External Connections (only necessary for containers)

    1. For containers:
      • Toggle the setting “Make this container accessible from the internet?” to enable
      • Go to the External Connections tab
      • Click on "Enable External Connections"
    2. For databases and message queues:
      • Click on "Enable External Connections".
  4. Add an external connection

    In the wizzard, configure the external connection.

    1. Select Dedicated IP and click Submit request
    2. For now, you will be requested to fill in a form which will send your request to us. We will configure the connection for you and inform you as soon as its ready.

Important

Currently, the external connection over dedicated IP will not become visible in the Nexaa Portal and will also not be manageable from there. To change the configuration of the external connection, please submit a support ticket. Self-service management of external connections over dedicated IP will be supported in the future.