Moving Synapse media to S3-compatible object storage

A planned move of Synapse media from local disk to S3 or an S3-compatible service, using the documented storage provider and upload script, with a careful cache trim at the end.

On this page

Moving Synapse media to S3 object storage: what the move involves

A local media directory on the Synapse host that keeps growing is a storage problem that compounds: it strains disk capacity, slows backups and lengthens restores. The move to S3-compatible object storage is a documented storage-provider change plus a one-time upload of existing files and a trim of the local cache. Effort depends on three things: the volume of media already stored, the S3 target you choose (Amazon S3 or a self-hosted service), and how many objects must be checked before local copies are deleted.

The media store is the only data this work moves. The PostgreSQL database, the signing keys and the configuration that defines your server_name stay where they are, and they are not changed by the storage switch. Keep that boundary explicit in the plan, because a database or key problem found during a media migration is a separate incident with separate recovery steps. Plan the work as a sequence rather than a single command: configure the storage provider in homeserver.yaml and test reads and writes, run s3_media_upload against a copy or a limited set first, verify object counts and sample downloads, then trim the local cache on a schedule set by your retention needs. Confirm the exact configuration keys and script options against the synapse-s3-storage-provider repository for the version you run.

Ask for a quote that names the S3 target, the expected media volume, the verification method and the rollback path, since rollback depends on keeping local copies until verification passes. Recurring cost sits with the storage service you pay for, and one-time cost covers the upload window, testing and cutover. If you choose a self-hosted S3-compatible service, confirm its current maintenance and licensing status before committing, because the MinIO community project is no longer maintained and its tagged releases have stopped.

Choosing Amazon S3 or an S3-compatible target

Amazon S3 is the reference target that synapse-s3-storage-provider is built to store media in. Using it means the storage service is operated by AWS, so your team manages buckets, IAM policies, encryption settings and billing rather than storage hardware or software upgrades. The provider reads AWS credentials and bucket details from its configuration, and no endpoint_url is needed when you use the standard AWS endpoints.

  • Operational load: AWS runs the storage nodes, durability and replication, so your team owns the bucket and access configuration.
  • Access control: Scope an IAM user or role to the single media bucket with only the actions the provider and the upload script need.
  • Recurring cost: Storage, request and data transfer charges recur monthly and grow with the media store, so ask for a cost estimate based on your current media volume.
  • Data location: Choose the AWS region that matches your data residency requirements and confirm it before creating the bucket.
  • Support: Support tiers come from AWS and are contracted separately from DeployOpen's scope.

Before choosing this target, confirm with your compliance team that AWS hosting meets your data residency and sub-processor requirements, and confirm current AWS pricing and region availability directly with AWS.

What moves cleanly and what does not

This table compares how each part of Synapse media handling maps from the local media directory to an S3 bucket managed by synapse-s3-storage-provider. Read the left column for the item, then check whether it moves cleanly or stays tied to the database, keys and local state. The main takeaway is that the object store holds files only, so the database, signing keys and any deleted local copies still determine whether the server works and whether you can roll back.

ItemLocal media directoryS3-backed storage
Original uploadsStored as files under the local media path on the homeserverStored as objects in the bucket and fetched through the storage provider on request
Media served to clientsServed directly from the local path by SynapseFetched through the provider on demand, so bucket access and network path must be reliable
ThumbnailsGenerated and kept in the local media storeCan be written to the bucket, but confirm the provider's thumbnail behavior for your version
Remote media cacheFiles fetched from other servers kept locallyCached copies can be trimmed by age, and fetched again from the bucket when needed
Local cache trimmingFiles stay until removed by an admin or media retention jobTrimmed by last-access age with s3_media_upload, so copies older than the chosen period are deleted locally
Media IDs and paths in the databaseDatabase records media IDs that point to local pathsDatabase still holds the same media IDs, so these must stay consistent with the bucket keys
Database and signing keysRequired to run the homeserverNot replaced by the provider; you still back up PostgreSQL and signing keys separately
RollbackReverting to local files is straightforward while local copies existLimited once local copies are deleted; confirm the restore path before trimming

Documented tools for the move

The migration relies on four documented pieces, each with a different job: a storage module, an endpoint option, an upload script and a client for checking results. Read them together before you change production media settings, because the object store you choose determines how much of this path you can rely on.

Storage provider module

The synapse-s3-storage-provider module is an Apache-2.0 Synapse storage provider that stores and fetches media in Amazon S3. It is installed into the same Python environment as Synapse and registered in your media storage provider configuration, so Synapse reads new and existing media through it. Pin the module version to your Synapse release by checking the provider repository's compatibility notes before installation, and retest after every Synapse upgrade.

Provider repository

Endpoint URL for S3-compatible services

The module's endpoint_url option points it at an S3-compatible service instead of Amazon S3. Use it for a self-hosted object store in your own data center or for a provider that implements the S3 API. Ask the service operator to confirm which S3 operations the store supports, including the reads, writes and deletes the module and upload script depend on, and test a full write, read and delete cycle against a non-production bucket before cutover.

Upload and trim local media

The s3_media_upload script copies existing local media into the S3 bucket. It can also delete local copies, using a cache of files not accessed within a chosen period such as 2 months to decide what to remove. Run it in stages with local deletion disabled first, confirm the bucket holds every file you expect, and only then enable deletion. Keep a backup of the media directory until restores from the bucket have been verified.

Checking bucket contents with mc

The mc command-line client from the MinIO project lists buckets, compares object counts and inspects object paths. Use it to confirm that uploaded media matches your local file inventory before you trim the cache. The minio/mc repository is archived, so confirm that your copy of mc works with your storage service, and test another S3 client as a fallback before you depend on either one.

mc repository

Check the MinIO project status

If you plan to run MinIO behind the endpoint, note that the minio/minio repository is no longer maintained and that its community server is distributed as source code only, with no further pre-compiled binaries. The README points to AIStor Free and AIStor Enterprise as alternatives. Because the community server is licensed under AGPLv3, have counsel confirm your licensing position before building a commercial service on it, and choose the object store before writing the endpoint configuration.

Last tagged release
Oct 16, 2025
MinIO README

Sequence: inventory, pilot, parallel run and cutover

This sequence moves a growing Synapse media store to S3-compatible object storage in stages, so each step has a verification check before the next one changes data or removes local files.

  1. Inventory media size, object counts and retention

    Measure the media directory on the Synapse host, including total size, file count, growth over recent months and how many files have not been accessed within the period you plan to keep locally. Record which retention rules apply to uploaded media and whether any content must be kept for legal or policy reasons. Ask the storage team to confirm capacity and request rates for the target bucket before you commit. Done when you have a written inventory that another engineer can reproduce from the same commands and a signed-off retention statement.

  2. Stand up a pilot bucket and test homeserver

    Create a non-production bucket in Amazon S3 or your S3-compatible service, with access limited to a dedicated service identity, and deploy a test Synapse homeserver with a copy of the production configuration and a sample of media. Confirm that the endpoint, region and credentials work from the test host using a plain S3 client before involving Synapse. Done when a test object uploaded and read back from the bucket matches its checksum and the test homeserver starts without errors.

  3. Configure the provider and run a dry run

    Install synapse-s3-storage-provider on the test homeserver, add the media storage provider entry to the homeserver configuration with the bucket, endpoint_url and credentials, and set the local cache options your team has chosen. Run the s3_media_upload script in dry-run mode against a copy of the uploads so it reports what it would move without changing anything. Done when the dry-run output matches the inventory counts and the homeserver can still serve a sample of existing media.

  4. Run a full upload against a copy of the media

    Run s3_media_upload against the copied media store without deleting local files, and let it finish completely. Then compare object counts and sizes in the bucket with the local copy, and check that a random sample of media downloads through the test homeserver with the expected content type. Record any files that failed, investigate each one, and rerun until the failure list is empty or every remaining file is explained. Done when counts, sizes and sampled reads all agree.

  5. Run the parallel period in production

    Enable the provider on the production homeserver so new uploads are written to S3 while existing media remains on local disk and is still served from there. Monitor upload errors, media download failures and bucket request errors daily during this period. Keep local copies intact throughout. Done when new uploads appear in the bucket, old media loads from local storage, and the error log shows no recurring storage errors over the period your team has agreed.

  6. Upload existing media and delete local copies after verified reads

    Run s3_media_upload against production media with local deletion enabled only for files that have been verified in the bucket, using the age threshold your retention decision set. Before deleting anything, confirm that the upload log, bucket inventory and a sample of reads all agree for those files. Keep a backup of the local media store until the cutover has been checked. Done when the upload run reports no unverified deletions and a sample of previously local media loads from S3 through the homeserver.

  7. Schedule the cache trim

    Set a recurring job that runs the cache trim with the access window from your retention decision, so the local cache holds only recently used media. Review the job log after each run and compare local disk usage and bucket size with the inventory baseline. Done when two consecutive scheduled runs complete without errors and local disk use stays within the level your capacity plan expects.

  8. Decommission the old storage path

    After the cutover has been stable for the period your team agreed, remove the old media directory from the Synapse configuration, archive or delete the remaining local copies according to your retention policy, and update backup jobs so they no longer expect the old path. Keep a documented restore path for the bucket. Done when the homeserver starts and serves media from S3 with no reference to the old path, the backup job reflects the new layout, and the change record is filed.

How media requests flow once the provider is active

Once synapse-s3-storage-provider is configured, Synapse still receives every media upload on the local host, but the provider moves the bytes to the bucket as part of storing them, so the local media store becomes a cache rather than the system of record. A write from a client lands in S3 through the provider, and the local copy then ages out under the cache policy you set. A read for media that is still local is served from disk as before. A read for media that has been trimmed triggers a fetch from the bucket, which adds network round trips and depends on the bucket and its endpoint being reachable from the Synapse host. Plan for that extra latency on first access to older media, and measure it in your own environment rather than assuming the figure from a test setup will hold.

Several behaviors need confirmation in the provider's own documentation before you rely on them. Check how the provider handles thumbnails, which Synapse generates on demand and stores alongside originals, and whether thumbnail objects are written to S3, kept locally, or both. Check whether the provider's configuration options control that split, and what happens to thumbnails when the local cache is trimmed. Also confirm how the provider behaves when the bucket is unreachable during an upload or a download, including whether uploads are retried, queued, or failed back to the client, because the answer determines what users see during an outage.

The cache period interacts directly with your access pattern. If your users mostly open recent files, a short retention in the local store keeps most reads on disk. If they reopen old rooms or search through historical attachments, a short period turns many reads into bucket fetches. Confirm with the provider documentation which timestamp the cache check uses, such as last access or creation, since that decides whether a frequently opened old file stays local. Then review Synapse access logs and bucket request metrics for a representative period before you pick the cache period for production.

Media flow before and after the move

The diagram starts with Synapse writing new media through the synapse-s3-storage-provider, which stores files in the S3 target and keeps a local cache. The s3_media_upload script then copies existing local files to the bucket and can remove local copies that have not been accessed within a chosen period. The cutover point is when new uploads go only to S3, and verification confirms that media from both older and newer uploads loads correctly before local copies are trimmed.

Synapse media moves from local storage to an S3 target through the provider and upload script.

What drives the effort and duration

This table compares the factors that change how much work the media move takes and what it costs over time, with each row naming who pays and whether the cost is one-time or recurring. Read it before asking a partner or your own team for an estimate, and use the last rows to shape the written quote.

DriverWhy it changes effort or costHow to keep it down or what to confirm
Total media size and object countUpload time, transfer volume and the number of API requests scale with how many files and how many gigabytes sit in the local media store. Many small files add request overhead even when total size is modest.Measure the media directory size and file count before scoping. Ask for the plan to be based on those numbers, not on an assumed figure.
Self-hosted or managed targetA self-hosted S3-compatible service means your team or the partner runs the storage, backups and patching. A managed Amazon S3 or other provider bills for storage and requests, and the operating work moves to the provider.Decide the target before the quote. Ask who operates the bucket service, who patches it and who owns the SLA, if any.
Network path and bandwidth to the bucketThe upload runs over the link between the homeserver and the bucket. A slow or metered path lengthens the bulk upload, and later media fetches depend on the same path.Confirm whether the bucket sits in the same network or region as the homeserver. Ask whether the upload window can run outside peak hours.
Single process or worker deploymentA single process can use the storage provider directly. A worker deployment must have the storage provider configured consistently on every process that reads or writes media, which adds configuration and test steps.Confirm the worker layout first. Ask the partner to name every process that handles media and to test each one.
Retention and local cache policyDeciding how long files stay on local disk, such as files not accessed within a chosen period, controls how much is uploaded in one pass and how much is deleted afterward. Legal hold or retention rules can prevent local deletion entirely.Agree the retention rule in writing before the run. Ask for a dry run that lists what would be deleted.
Backup scope and recovery testingMedia in S3 needs its own backup or replication plan, separate from database backups. Restore tests for media add time, and the scope of those tests changes the effort.Ask whether the quote includes a restore test of a sample of media files and who keeps the backup copies.
Number of verification checks requiredEach check your organization requires, such as checksum comparison, sampled client fetches or audit evidence, adds test and documentation time before cutover.List the checks your security or compliance team expects before the quote is written. Ask which checks are included and which are extra.
One-time work: upload, testing and cutoverPaid once: planning, configuration, the bulk upload with s3_media_upload, verification and the cutover window. Usually billed as a fixed-scope project.Ask for each phase as a separate line with its deliverable, so you can see what you are paying for.
Recurring costs: storage, requests, egress and supportManaged storage bills recur for stored bytes, requests and data transferred out. Self-hosted storage recurs as hardware, power, operations and support time. Support contracts recur separately.Ask for the expected monthly storage footprint, the provider's price sheet and who pays for each line item, and whether support is a separate retainer.

Questions buyers ask before moving Synapse media to S3

What does moving Synapse media to S3 cost, and how is the cost built?

The cost is built from four parts: the planning and configuration work, the upload run and its verification, the object storage service you pay for each month, and the operational time to keep it running. The software itself is free. synapse-s3-storage-provider is Apache-2.0 licensed, and the storage bill depends on how much media you hold, how often it is read, and whether you use Amazon S3 or a self-hosted S3-compatible service. Ask any partner for a written quote that separates one-time work from recurring storage and support. Confirm the storage pricing with your provider or your own environment, since no figure is supplied here.

How long does the migration take, and what sets the duration?

Duration depends mainly on the volume of local media, the upload throughput from your Synapse host to the bucket, and how many test cycles you run before cutover. The s3_media_upload script must read every existing file, so a large media store on a slow disk or a constrained network link takes longer. Plan for a staging run on a copy of the media directory, then a timed production run. No general timeline is supplied here, so measure the upload rate in your own environment before committing to a date.

What does our organization have to provide before the work starts?

You need a Synapse version that the provider supports, a bucket with credentials scoped to that bucket, network access from the Synapse workers to the S3 endpoint, and a maintenance window for the cutover. You also need a current backup of the media directory and the database, and an owner who can approve deleting local copies. If you use an S3-compatible service, you need its endpoint URL and confirmation that it behaves as S3 for the operations the provider uses. Check the provider's repository before assuming compatibility.

Can an internal team do this migration alone?

Yes, if the team already operates Synapse, understands Python configuration, and has tested restores. The work is a bounded set of steps: install the storage provider, configure it, run an upload against a copy, verify retrieval, then run the cutover. The hard parts are verifying that every media type still loads, confirming the cache trimming rule before any local files are removed, and documenting the rollback path. Teams without recent Synapse operations experience usually benefit from a fixed-scope partner engagement with written verification steps. DeployOpen plans and implements this work inside your infrastructure, with the deliverables agreed in writing first.

Is MinIO still safe to choose for S3-compatible storage?

Treat MinIO as a risk to evaluate, not a default. The minio/minio README says the repository is no longer maintained and points to AIStor Free and AIStor Enterprise as alternatives. The community repositories for the server, operator and mc client are archived, and the last tagged community release is RELEASE.2025-10-15T17-29-55Z, published on October 16, 2025. The community edition is AGPLv3 and distributed as source only, and its README says community support is best effort. Before choosing it, ask whether you will maintain your own builds and security patches, and compare the options with the AIStor terms or another S3-compatible service.

How does rollback work once local media has been deleted?

Rollback is only simple while local copies still exist. The s3_media_upload script can delete local files that have not been accessed within a chosen period, so deletion should happen only after a verified upload and a period of normal operation. Keep a full backup of the media directory until you have confirmed that files load from S3, and record the exact configuration you changed. If local copies are gone and the bucket is the only source, a rollback means restoring from your backup or re-downloading from the bucket. Ask your partner to write this restore path into the runbook before the cutover.

What should we check after cutover to confirm media still works?

Check that new uploads land in the bucket, that old media still loads for users on several clients, and that thumbnails and remote media behave as expected. Also check the Synapse logs for storage errors and confirm that the cache trimming job does not remove files still needed. Measure the bucket contents against the local directory before deletion. Keep the checks in a written list so the on-call team can repeat them after upgrades or configuration changes.

What usually goes wrong and how to prevent it

Most media-to-S3 failures come from moving data faster than it can be verified. The cards below cover the risks that appear during upload, cutover and steady-state operation, and the check that catches each one before it causes data loss or user-visible breakage.

Deleting local copies too early

The s3_media_upload script can remove local files after upload, so a failed or partial run can leave media in neither place. Run the upload without deletion first, then confirm that object counts and sizes in the bucket match the local media directory. Only enable deletion for the files you have verified, and keep a full backup of the media directory until a restore test from S3 succeeds. Never delete before verification.

Storage provider docs

Mismatched bucket permissions

The Synapse process needs read and write access to the bucket for uploads, fetches and deletes, and the upload script runs with the same credentials. A policy that grants only write access will appear to work until the first media request is served from S3. Test the exact credential Synapse uses against a non-production bucket, and confirm that public access is blocked unless you have decided otherwise.

Choosing an unmaintained target

The MinIO community repositories are archived and the README says the community server is no longer maintained, with binaries no longer published. Building it from source puts patching, TLS and capacity planning entirely on your team. Before choosing an S3-compatible target, ask the vendor for its current maintenance status, release cadence and support terms, and confirm the license obligations for your use.

MinIO README

Cache trimming removes media still in demand

The cache period controls which local files are eligible for deletion, based on last access. A short window can remove recently uploaded media that users still open often, forcing repeated fetches from S3 and slowing the client. Choose the period from your own access logs, not from a default, and watch for a rise in media fetch latency after the first trim.

Latency regressions after cutover

Once media is served from object storage, every cache miss adds a network round trip between Synapse and the bucket endpoint. If the bucket sits in a different region or behind a slow link, image and file loads will be visibly slower than before. Measure media fetch times from a client on your network before and after cutover, and place the storage endpoint close to the homeserver.

Database and media falling out of sync

Synapse stores media metadata in its database, and a restored database that points to files missing from the bucket, or a bucket that lacks files recorded in the database, produces broken media links. Stop writes or schedule the move in a window, take a database backup alongside the media snapshot, and check a sample of media IDs from the database against the bucket after the upload finishes.

How DeployOpen scopes and delivers the media move

DeployOpen delivers the media move as a fixed-scope engagement in which the scope, deliverables and timeline are agreed in writing before any work starts. For this migration, the written scope should name the Synapse version and deployment method, the storage provider and its configuration, the target bucket and any S3-compatible service, the number and size of existing media files that will be moved, the cache period used by the trim, and who signs off on each stage. Nothing in the engagement is priced from a published list. A quote follows from that written scope, so the more precisely your environment is described during scoping (media store size, worker layout, backup status, and whether the target is Amazon S3 or a self-hosted service), the more closely the quote reflects the work.

The delivery sequence starts in your infrastructure rather than on a demo environment. DeployOpen installs and configures synapse-s3-storage-provider on a staging homeserver, points endpoint_url at the target service where one is used, and tests reads, writes and fetches of media through Synapse before any production file moves. Our team then runs s3_media_upload against a copy of the media store, checks object counts and sample checksums against the local files, and only then runs the trim against the production store with the agreed cache period. Verification covers media that is still served after the local copy is removed and the behavior of the backup job. Ongoing support, including storage provider upgrades, periodic verification and handling of new media growth, is available as a retainer after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.