Home / OCI

OCIHow-toIntermediate

Copying AWS S3 buckets to OCI Object Storage with rclone: native OCI backend, instance principals and verification

Move S3 buckets into OCI Object Storage with rclone's native Oracle backend and instance principals, tune throughput, run delta passes and verify the copy before cutover.

Deepak Bhardwaj7 min read

Applies toOCI Object Storage, AWS S3, rclone 1.62+ (oracleobjectstorage backend), Oracle Linux 8/9 on OCI Compute

Goal

You need to move one or more S3 buckets into OCI Object Storage: a few hundred GB to tens of TB, millions of objects, with a short cutover window at the end. You want a copy you can re-run, logs you can show to the application owner, and proof that nothing went missing.

rclone does this well. Since version 1.62 it has a native oracleobjectstorage backend, so on an OCI instance it can authenticate with an instance principal. You don't need Customer Secret Keys or the S3 Compatibility API.

Note

There is no server-side copy between AWS and OCI. Every byte flows through the machine running rclone. Run it on an OCI instance in the target region, size the instance for network bandwidth, and expect AWS data transfer out charges on the source side. Check current AWS pricing before you start a large copy.

1. Prepare the OCI side

Create the target bucket first. Set versioning, tier and encryption now, because changing them after 20 million objects have landed is painful.

oci os bucket create \
  --compartment-id ocid1.compartment.oc1..xxxx \
  --name media-archive \
  --storage-tier Standard \
  --versioning Disabled

Create a dynamic group for the migration instance, then give it write access to the bucket's compartment:

# Dynamic group "rclone-migrators" matching rule
ANY {instance.id = 'ocid1.instance.oc1.eu-frankfurt-1.xxxx'}

# Policy
Allow dynamic-group rclone-migrators to read buckets in compartment Storage
Allow dynamic-group rclone-migrators to manage objects in compartment Storage

manage objects covers create, overwrite and delete. If you only ever run rclone copy and never sync, you can tighten it later with a condition on request.permission.

2. Install rclone and configure both remotes

Install a current rclone binary from rclone.org. Distribution packages are often older than 1.62 and won't have the OCI backend.

curl -fsSL https://rclone.org/install.sh | sudo bash
rclone version

Edit ~/.config/rclone/rclone.conf:

[s3src]
type = s3
provider = AWS
env_auth = true
region = eu-west-1

[oos]
type = oracleobjectstorage
provider = instance_principal_auth
namespace = <your-object-storage-namespace>
compartment = ocid1.compartment.oc1..xxxx
region = eu-frankfurt-1
  • env_auth = true makes rclone read the standard AWS credential chain (environment variables or a profile in ~/.aws/credentials). Use a read-only IAM user or role scoped to the source buckets.
  • Get the namespace with oci os ns get.
  • If you run rclone outside OCI, use provider = user_principal_auth with config_file and config_profile pointing at your OCI CLI config.

Check that both remotes work before you go further:

rclone lsd s3src:
rclone lsd oos:
rclone size s3src:media-archive

rclone size gives you the object count and total bytes. Record them, because you will compare against them at the end.

3. Run a dry run, then the first full copy

rclone copy s3src:media-archive oos:media-archive --dry-run --log-level INFO 2>&1 | tail -20

Then start the real copy in tmux or screen so an SSH drop doesn't kill it:

rclone copy s3src:media-archive oos:media-archive \
  --transfers 32 --checkers 64 \
  --oos-chunk-size 32Mi --oos-upload-concurrency 8 \
  --oos-no-check-bucket \
  --retries 5 --low-level-retries 20 \
  --stats 1m --stats-one-line \
  --log-file /var/log/rclone/media-archive-pass1.log --log-level INFO

Caution

Use rclone copy, not rclone sync, until cutover. sync deletes anything in the destination that isn't in the source. One typo in the source path can empty the target bucket.

Tuning knobs

Setting What it controls Starting point
--transfers Files copied in parallel 16–64; raise it for many small objects
--checkers Parallel listing and comparison workers 2× --transfers
--oos-chunk-size Multipart part size (default 5Mi) 16–64Mi for large files
--oos-upload-concurrency Parts uploaded in parallel per file (default 10) 4–16
--oos-upload-cutoff Size above which multipart is used (default 200Mi) Leave at default
--oos-storage-tier Tier the objects land in InfrequentAccess for cold data
--bwlimit Bandwidth cap, for example 500M or a timetable Use it if the source link is shared

Warning

Multipart buffers use roughly --transfers × --oos-upload-concurrency × --oos-chunk-size of memory. At 32 × 8 × 32Mi that's about 8 GiB. Size the instance memory for that, or rclone gets OOM-killed halfway through the copy.

Watch the instance's network throughput while it runs. If CPU is low and throughput is flat, raise --transfers. If you see 429 or 503 responses in the log, lower it. rclone retries them, but sustained throttling slows the whole job.

4. Delta passes and verification

Re-running the same rclone copy command only copies new or changed objects. By default it compares size and modification time, and it stores the source modtime on OCI as opc-meta-mtime. Run delta passes daily until cutover so the final pass is small.

To verify, compare listings and hashes:

rclone check s3src:media-archive oos:media-archive \
  --one-way --checkers 64 \
  --missing-on-dst /tmp/missing.txt \
  --differ /tmp/differ.txt \
  --log-file /var/log/rclone/media-archive-check.log
  • --one-way checks only that everything in the source exists in the destination.
  • missing.txt lists objects that never arrived. Re-run copy with --files-from /tmp/missing.txt to fill the gaps.
  • rclone compares MD5 hashes where both sides have them. Objects uploaded to S3 with multipart by other tools often have no usable MD5. rclone then compares only their size and reports how many hashes it couldn't check. For a stricter check on critical data, add --download, which reads both copies and compares the bytes. This is slow, and it adds egress cost on the AWS side.

Finally, compare totals with the numbers you recorded in step 2:

rclone size oos:media-archive

5. Cutover

  1. Stop writes to the S3 bucket. Freeze the application or switch it to read-only.
  2. Run a final delta rclone copy, then rclone check --one-way.
  3. Point the application at OCI: either the native OCI SDK, or the S3 Compatibility API endpoint https://<namespace>.compat.objectstorage.<region>.oraclecloud.com with Customer Secret Keys.
  4. Keep the S3 bucket read-only for an agreed period before you delete anything.

If you need the destination to mirror deletions made during the migration window, run a reviewed rclone sync --dry-run first. Read the planned deletes in the log, then run it for real.

Troubleshooting

Symptom Cause Fix
didn't find section in config file for oos Remote name typo, or the wrong config path for the user running rclone Run rclone config file and check which file is in use
NotAuthorizedOrNotFound on upload Dynamic group rule doesn't match the instance, or the policy is in the wrong compartment Check the matching rule and the policy compartment; allow a few minutes for IAM changes to apply
BucketNotFound while the bucket exists Wrong namespace, region or compartment in the remote Fix them with oci os ns get and oci os bucket get --name ...
unknown backend "oracleobjectstorage" rclone older than 1.62 Install the current release from rclone.org
Copy stalls with high memory use Chunk size × concurrency × transfers too high Lower --oos-upload-concurrency or --oos-chunk-size
Bucket filling with incomplete uploads after crashes Multipart uploads interrupted rclone backend list-multipart-uploads oos:media-archive, then rclone backend cleanup -o max-age=24h oos:media-archive

Prevent it next time

  • Keep the rclone.conf, command lines and log files in the change ticket so the copy can be repeated and audited.
  • Add an Object Storage lifecycle rule that removes uncommitted multipart uploads after a few days.
  • Use a dedicated instance principal with access to the target compartment only, and delete the dynamic group after cutover.
  • Run rclone check --one-way as the final gate in every migration runbook, not just this one.