Skip to content

Aiven

How to back up and restore Aiven managed databases via SimpleBackups.

Aiven is a managed database platform that supports MySQL, PostgreSQL, and other database engines. SimpleBackups can connect to your Aiven database either automatically via the Aiven API — which discovers your databases without manual configuration — or manually using a connection string. Both methods work for MySQL and PostgreSQL.

Automatic setup

In this section, you will generate an Aiven API token and connect your Aiven project to SimpleBackups so that databases are discovered automatically.

Step 1: Obtain Aiven API credentials

You can use either a personal token or an application token.

Option A: Create a personal token

  1. Go to https://console.aiven.io/profile/tokens.
  2. Click Generate token.
  3. Select a session duration or leave it empty, then click Generate.
  4. Copy the generated token to a safe location.

Aiven personal token generation screen

Option B: Create an application token

  1. Go to the Admin section from the top navigation bar.
  2. Select Application users from the left sidebar.
  3. Click Create application user and choose a name.

Aiven application user creation screen

  1. From Actions, choose View profile.
  2. Under Authentication tokens, click Generate token.
  3. Select a session duration or leave it empty, then click Generate.
  4. Copy the generated token to a safe location.
  5. Select Permissions from the left sidebar.
  6. Click Grant permissions, then Grant to users.
  7. Select the application user you just created and assign the Read Only role under Project Roles.

Aiven permissions screen showing Read Only role assignment

Step 2: Get the project name

  1. From the navigation bar, go to Projects.
  2. Select View all projects.
  3. Choose the project that contains the database you want to back up.
  4. From the menu, choose Settings and copy the Project Name.

Aiven project settings screen showing project name

Step 3: Connect Aiven to SimpleBackups

  1. Go to the database backup page and click Add in the Connect your DBaaS Provider section.
  2. Select Aiven from the Provider dropdown, enter a name for your Aiven account, paste the token and project name from the previous steps, then click Save provider.

Aiven provider connection form in SimpleBackups

Aiven provider saved confirmation

  1. Select the managed database you want to back up.
  2. Click Load.

Database selection screen in SimpleBackups

Step 4: Validate and activate

Click Validate connection to confirm that SimpleBackups can reach your database. Once validated, configure your schedule and activate the backup.

Manual setup

Use this approach if you prefer to supply connection credentials directly rather than through the Aiven API. The steps are the same for MySQL and PostgreSQL — only the connection string format and the database type you select in SimpleBackups differ.

Step 1: Copy your connection string

  1. Log in to your Aiven console.
  2. Navigate to the database service you want to back up.
  3. Click Overview, then Connect, or refer to Connection Details on the dashboard.
  4. Copy the connection string and replace the **** placeholder with your actual password.

For MySQL, your connection string will look like this:

Aiven MySQL connection details screen showing the connection string

For PostgreSQL, your connection string will look like this:

Aiven PostgreSQL connection details screen showing the connection string

You can also find the Service URI in the Connection information section, along with a downloadable CA certificate.

Aiven connection information screen showing Service URI

Step 2: Whitelist SimpleBackups IP addresses

  1. In the Aiven console service overview, scroll down to the Allowed IP Addresses section and click Change.
  2. Add the IP addresses provided by SimpleBackups to the allowlist.

Aiven IP allowlist configuration screen

You can also configure IP filtering from the Network section by choosing Set public IP filters.

Aiven IP filter configuration screen

Aiven IP filter entry form

Step 3: Create a database backup in SimpleBackups

  1. Navigate to Backups and click Create Backup, then select Database Backup.
  2. Choose Serverless as the backup server type.
  3. Select the database Type: choose MySQL for an Aiven MySQL database, or PostgreSQL for an Aiven PostgreSQL database.
  4. Click Paste connection string and paste the connection string you copied, making sure the password is included.
  5. Click Validate Connection.

For MySQL:

SimpleBackups database connection form with MySQL connection string

For PostgreSQL:

SimpleBackups database connection form with PostgreSQL connection string

  1. Set a schedule for your backups and configure retention policies and storage.

SimpleBackups backup schedule configuration screen

  1. Review your configuration and save. SimpleBackups will start backing up your database according to your schedule.

Restoring a backup

To restore a backup, navigate to your backup page and open the Logs tab. Click the detail icon on the backup you want to restore from, then open the Restore tab. Generate a download link and copy it.

Aiven backup logs tab

Aiven backup detail view

Aiven restore tab with download link

Run the following command to download and decompress your backup (replace the URL with your signed download link):

bash
wget -O - "<signed-download-url>" | gunzip -c > backup.pgsql

Then restore using pg_restore, replacing <your-database-uri> with your full database connection string:

bash
pg_restore -d "<your-database-uri>" ./backup.pgsql