R2BucketSippy
Source:
src/Cloudflare/R2/BucketSippy.ts
Sippy — incremental migration from AWS S3 or Google Cloud Storage into a Cloudflare R2 bucket.
When Sippy is enabled on a bucket, any object requested from R2 that is not yet present is fetched from the configured source bucket, served, and copied into R2 — migrating data on demand without a bulk transfer and without paying double storage during the transition.
One Sippy configuration exists per bucket (it is a singleton sub-resource of the bucket). Destroying the resource disables Sippy; objects already migrated stay in the R2 bucket.
Migrating from AWS S3
Section titled “Migrating from AWS S3”const bucket = yield* Cloudflare.R2Bucket("Media");
yield* Cloudflare.R2BucketSippy("MediaMigration", { bucketName: bucket.bucketName, source: { provider: "aws", bucket: "legacy-media", region: "us-east-1", accessKeyId: alchemy.secret.env.AWS_ACCESS_KEY_ID, secretAccessKey: alchemy.secret.env.AWS_SECRET_ACCESS_KEY, }, destination: { accessKeyId: alchemy.secret.env.R2_ACCESS_KEY_ID, secretAccessKey: alchemy.secret.env.R2_SECRET_ACCESS_KEY, },});Migrating from Google Cloud Storage
Section titled “Migrating from Google Cloud Storage”yield* Cloudflare.R2BucketSippy("MediaMigration", { bucketName: bucket.bucketName, source: { provider: "gcs", bucket: "legacy-media", clientEmail: "sippy@my-project.iam.gserviceaccount.com", privateKey: alchemy.secret.env.GCS_PRIVATE_KEY, }, destination: { accessKeyId: alchemy.secret.env.R2_ACCESS_KEY_ID, secretAccessKey: alchemy.secret.env.R2_SECRET_ACCESS_KEY, },});