Move data from an Upstash Redis database created with fly redis to ElastiCache in your own AWS account, either by copying keys lazily through fly redis proxy or by exporting an RDB from the Upstash console.

Fly Redis is an Upstash Redis database provisioned inside your Fly organization with fly redis create. Apps in that org reach it over a private IPv6 address. Once the app moves to AWS, those keys have to reach Amazon ElastiCache without emptying sessions or queues.
This guide moves the data to ElastiCache in your own AWS account. It starts with Encore, which provisions ElastiCache from Go and copies keys lazily, then covers an RDB export from the Upstash console.
The redis://...upstash.io URL that fly redis status prints is restricted to the Fly organization network. From a laptop, fly redis connect proxies local port 16379 and opens redis-cli, and fly redis proxy leaves a tunnel you can point a migration tool at. Upstash does not support the replication handshake, so redis-cli --rdb is the wrong export tool here.
Inventory the keyspace through the tunnel before choosing a strategy, and record the Redis version and whether eviction is enabled.
Encore brings infrastructure from code: the Redis cluster and a typed keyspace are declared in the service that uses them, and deploying to AWS creates ElastiCache, as listed in the AWS infrastructure docs. During the copy window, a go-redis client can read the old database through a controlled path while live traffic fills ElastiCache.
A coding agent can add the keyspace and the fallback load path in the same change. Store any password as an Encore secret so it is not in the repository.
Run in your terminal to get started locally.
// carts/carts.go
package carts
import (
"context"
"time"
"encore.dev/beta/errs"
"encore.dev/storage/cache"
"github.com/redis/go-redis/v9"
)
var cluster = cache.NewCluster("carts", cache.ClusterConfig{
EvictionPolicy: cache.AllKeysLRU,
})
type Cart struct {
SKU string `json:"sku"`
Qty int `json:"qty"`
}
var Carts = cache.NewStructKeyspace[string, Cart](cluster, cache.KeyspaceConfig{
KeyPattern: "cart/:key",
DefaultExpiry: cache.ExpireIn(30 * 24 * time.Hour),
})
// Password or full URL used with fly redis proxy during rehearsal.
var secrets struct {
FlyRedisURL string
}
func source(ctx context.Context) (*redis.Client, error) {
opt, err := redis.ParseURL(secrets.FlyRedisURL)
if err != nil {
return nil, err
}
return redis.NewClient(opt), nil
}
func load(ctx context.Context, id string) (*Cart, error) {
rdb, err := source(ctx)
if err != nil {
return nil, err
}
defer rdb.Close()
var cart Cart
if err := rdb.HGetAll(ctx, "cart:"+id).Scan(&cart); err != nil {
return nil, err
}
if cart.SKU == "" {
return nil, cache.Miss
}
ttl, err := rdb.PTTL(ctx, "cart:"+id).Result()
if err != nil {
return nil, err
}
if ttl <= 0 {
ttl = 30 * 24 * time.Hour
}
if err := Carts.With(cache.ExpireIn(ttl)).SetIfNotExists(ctx, id, cart); err != nil && !errs.Is(err, cache.KeyExists) {
return nil, err
}
_ = rdb.Del(ctx, "cart:"+id).Err()
return &cart, nil
}
On a miss in ElastiCache, load reads the old cart and its remaining lifetime from the Fly Redis URL, writes it into the new keyspace with that TTL, and deletes the old key. Point FlyRedisURL at redis://default:<password>@localhost:16379 while fly redis proxy is running for a rehearsal. After the longest TTL has passed, remove the secret field and the fallback, and destroy the Fly Redis database once you are sure nothing still reads it. Encore provisions an IAM role for the service.
Best fit: apps leaving Fly whose Redis data has a natural expiry, with no freeze on writes.
For a full snapshot, open the database in the Upstash console, go to Backups, choose Backup and Export, and download the .rdb file when it finishes. That file is the dataset at export time; writes after it are not included. Redis Functions are not included in the export. Stop writers first if you need a consistent cutover, then seed ElastiCache from the file in a private subnet.
Best fit: a complete copy of a keyspace that can tolerate a write freeze around the export.
Pick Encore with a lazy copy when the data expires on its own and you want ElastiCache created from the service code. Pick an Upstash RDB export when you want a full snapshot and a short write freeze is fine. Let pure caches start empty either way.
Fly Redis is an Upstash database in your Fly organization. redis-cli --rdb usually cannot use the replication handshake against Upstash, so export an RDB from the Upstash console under Backups, Backup and Export, or copy keys through fly redis proxy with SCAN, DUMP and RESTORE. For local inspection, fly redis connect opens a tunnel and a redis-cli session.
Declare the cluster with cache.NewCluster and a typed keyspace, keep a go-redis client pointed at fly redis proxy or at the URL fly redis status shows, and on a cache miss copy the key and its PTTL into the Encore keyspace with SetIfNotExists. Encore provisions ElastiCache in your AWS account on deploy.
The redis:// URL is on the Fly organization's private IPv6 network and does not resolve from a laptop. Use fly redis proxy or fly redis connect to open a local tunnel, and keep that tunnel only for development or a migration pass, not as a production path from AWS.
If the database is a pure cache that can be rebuilt, start ElastiCache empty. Migrate sessions, queues or other keys that would drop work in progress if they disappeared.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.