How to Migrate Redis® from AWS to a Vultr Managed Database

Updated on June 22, 2024
How to Migrate Redis® from AWS to a Vultr Managed Database header image


This guide explains how you can migrate your AWS Cloud Database to Vultr with minimal downtime to the source database applications. Vultr Managed Databases for Caching offers reduced costs, easy management and backups, scheduled updates, quick scaling, straightforward monitoring, and automated failover to replica nodes in case of database failures.


Before your start:

  • Verify that your source AWS Cloud Database accepts connections from any source
  • Deploy Vultr Managed Database for Caching with the same size as your AWS database.

Migrate Redis®

This section explains how you can migrate Redis® data from your Elastic Cache for Redis® database to a Vultr Managed Database for Caching. You'll connect to the Redis® cluster using stunnel listening on localhost port 2000 for the source, and 4000 for the target, then use a bash script to migrate the Redis® data to the Vultr Managed Database for Caching.

  1. Open and edit your stunnel configuration file.

       $ sudo nano /etc/stunnel/stunnel.conf
  2. Add the following configurations to the file.

      fips = no
      setuid = nobody
      setgid = nogroup
      pid = /tmp/stunnel-pid/
      debug = 7
      delay = no
        client = yes
        accept =
        connect = vultr-prod.vultrdb:1234
        client = yes
        accept =
        connect =

    Save and close the file.

    For more information on configuring stunnel, please visit how to connect your Redis database using stunnel.

  3. Using redis-cli, access your source Redis® database server.

      $ redis-cli -h -p 2000

    Enter the Redis password.

      > auth PASSWORD
  4. Select the database you intend to migrate.

      > select 1
  5. Make a database snapshot to save a backup before migration.

      > save
  6. Exit the Redis interface.

      > exit
  7. Create a new bash file, for example

      $ touch ~/
  8. Open and edit the file using a text editor of your choice.

      $ nano ~/
  9. Add the following Redis® migration configurations to the file.

      set -euo pipefail
      read  -p "Please enter source Amazon Redis password: "sourcepass
      read  -p "Enter your Vultr Managed Redis Database password: "vultrpass
      while [[ "$count" -ne 0 ]]; do
        if [["$count" -eq -1 ]]
      redis-cli  -a -n
      reply=$(redis-cli -h localhost 2000 -a "$sourcepass" -n "$source" SCAN "$count")
      if [ -n "$reply" ]; then
           echo "$reply" | tail -n +2 |
           while IFS= read -r key; do
                  redis-cli -h localhost 2000 -a "$sourcepass" -n "$source" migrate localhost 4000 "$key" "$target" 4000 copy auth "$vultrpass" >/dev/null 2>&1
      count=$(expr "$reply" : '\([0-9]*[0-9]\)')

    The above configurations use the Redis® scan and migrate commands to process database keys, then migrate them to the target database. Upon execution, you should pass the source and target database by number, then enter the associated passwords when prompted.

    Save and close the file.

  10. Make the script executable.

      $ sudo chmod +x ~/
  11. Run the script to start migrating your Redis® data.

      $ ./~/ 1 1

    The script arguments 1 1 refer to your source and target databases, respectively. Enter your source Redis® password. Enter your Vultr Managed Database for Caching password. When complete, test that your Redis® Database migration is successful.

Test the Migration

  1. Log in to your Vultr Managed Database for Caching Database.

      $ redis-cli -h -p 4000

    Enter the Redis® password.

      > auth PASSWORD
  2. Select your database.

      > select 1
  3. Scan keys stored in the database.

      > scan 1

    Verify that the data matches your source database.

  4. Exit the Redis® interface.

      > exit

Update Applications

Depending on the applications using your source database, cut over requests to your new database by editing the application's configuration files. Please refer to your application's official documentation on how to edit your database connection settings.


In this article, you have migrated an AWS Redis® database to a Vultr Managed Database for Caching. Depending on your database size, you can choose between the command line or graphical tools to safely migrate your database with no downtime to the applications using your database. For each migrated database, you can access logs and available databases through the Vultr Customer Portal. For more information about Vultr Managed Databases for Caching, see the Reference Guide.