Skip to main content
It is a framework for storing, reading and analyzing streaming data. See the Kafka documentation for more information.

Supported versions

You can select the major and minor version. Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.

Relationship reference

For each service defined via a relationship to your application, Upsun automatically generates corresponding environment variables within your application container, in the $<RELATIONSHIP-NAME>_<SERVICE-PROPERTY> format. Here is example information available through the service environment variables themselves, or through the PLATFORM_RELATIONSHIPS environment variable. You can obtain the complete list of available service environment variables in your app container by running upsun ssh env. Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the service environment variables directly rather than hard coding any values.
For some advanced use cases, you can use the PLATFORM_RELATIONSHIPS environment variable. The structure of the PLATFORM_RELATIONSHIPS environment variable can be obtained by running upsun relationships in your terminal:Here is an example of how to gather PLATFORM_RELATIONSHIPS environment variable information in a .environment file:
.environment
# Decode the built-in credentials object variable.
export RELATIONSHIPS_JSON="$(echo "$PLATFORM_RELATIONSHIPS" | base64 --decode)"

# Set environment variables for individual credentials.
export APP_KAFKA_HOST="$(echo "$RELATIONSHIPS_JSON" | jq -r '.kafka[0].host')"

Usage example

1. Configure the service

To define the service, use the kafka type: Note that changing the name of the service replaces it with a brand new service and all existing data is lost. Back up your data before changing the service.

2. Define the relationship

To define the relationship, use the following configuration:
You can define SERVICE_NAME as you like, so long as it’s unique between all defined services and matches in both the application and services configuration.The example above leverages default endpoint configuration for relationships. That is, it uses default endpoints behind the scenes, providing a relationship (the network address a service is accessible from) that is identical to the name of that service.Depending on your needs, instead of default endpoint configuration, you can use explicit endpoint configuration.With the above definition, the application container (APP_NAME) now has access to the service via the relationship SERVICE_NAME and its corresponding service environment variables

Example configuration

Exporting Data

Kafka stores messages in on-disk topic partitions. You can export messages using the kafka-console-consumer tool over an SSH session.
  1. Open an SSH session to your app container (Kafka is not directly accessible via tunnel:single):
Terminal
upsun ssh
  1. From the app container, list available topics:
Terminal
kafka-topics.sh \
  --bootstrap-server $KAFKA_HOST:$KAFKA_PORT \
  --list
  1. Export all messages from a topic to a file:
Terminal
kafka-console-consumer.sh \
  --bootstrap-server $KAFKA_HOST:$KAFKA_PORT \
  --topic <TOPIC_NAME> \
  --from-beginning \
  --max-messages <NUMBER> \
  --timeout-ms 5000 \
  > /tmp/kafka-export-<TOPIC_NAME>.txt
  1. Download the exported file:
Terminal
# From your local machine
upsun scp remote:/tmp/kafka-export-<TOPIC_NAME>.txt ./kafka-export-<TOPIC_NAME>.txt
The Kafka connection credentials (KAFKA_HOST, KAFKA_PORT) are available as service environment variables inside the app container. Note that Kafka is designed as a streaming platform, not a primary data store. In most architectures, the authoritative copy of your data exists elsewhere (for example in a database), and Kafka topics can be replayed or re-populated from that source.
Last modified on March 11, 2026