Storing Decidim uploads on S3, Azure or Google Cloud Storage

Decidim stores attachments through Rails Active Storage, so moving uploads off local disk is a configuration and verification project with browser-facing settings to get right. This page covers the steps, prerequisites and failure points.

On this page

Moving Decidim attachments off local disk with Active Storage

If your Decidim instance keeps uploads on the disk of one application server, you need shared, durable storage before you add a second server or rely on backups alone. In a production setup, Decidim handles file storage through Rails' ActiveStorage, so the change is made by configuring an ActiveStorage service rather than by installing a Decidim-specific connector. The provider families this section covers are Amazon S3, Azure Blob Storage and Google Cloud Storage. Each one is selected in the Rails storage configuration and its credentials are supplied through your secrets handling, so the decision is less about Decidim and more about which provider your cloud account, data center or contract already supports.

Treat three changes as one project. Uploads written by participants and administrators move to the new service, public assets such as images served to visitors may need a different delivery path, and browser-facing rules such as Content Security Policy and CORS must allow the bucket or container origin for the files people load and upload. If any one of these is left behind, the symptoms tend to appear only in the browser: broken images, blocked uploads or failed direct downloads. Before you cut over, confirm with your Decidim version's installation notes which ActiveStorage service name and configuration keys your release expects, and test an upload, a download and an image on a public page in a staging copy.

Plan the migration of existing files as a separate step from the configuration change. Existing attachments must be copied to the new provider and their records must still resolve after the switch, which is why you should take a database backup first and confirm the copy with a sample of files from each component. Ask the provider or your partner which costs recur for storage, requests and egress, and which are one-time, such as the initial transfer. Keep the local disk copy until the new setup has passed your checks, and record the retention rules for deleted attachments so that storage costs and privacy obligations are both understood from the start.

What you need before changing the storage backend

Moving Decidim attachments to object storage touches the application version, the database, the cloud account, the network and the certificates at once. Confirm each of these before you change a single setting, because a failed switch leaves participants with broken uploads and no clean way back.

Decidim version and runtime

Check your running Decidim minor version first. Version 0.32 requires Ruby 3.4.7 and Node 22.14.x, while 0.31 uses Ruby 3.3.4 and Node 22.14.x. Confirm the exact Active Storage gem and provider settings against the documentation for your version, because the storage configuration can differ between releases. Record the versions in your change ticket so the rollback plan matches the environment you actually run.

Manual installation guide

Database backup before the switch

Take a full PostgreSQL backup before changing the storage backend. Active Storage keeps attachment records in the database, and those records point to object keys. If you migrate files without a verified database snapshot, you cannot reliably reconcile which attachment belongs to which object. Test that the backup restores into a separate instance, not only that the backup job reports success.

Cloud account and bucket or container

Create the bucket for S3, the storage account and container for Azure, or the bucket for Google Cloud Storage before you touch Decidim. Decide who owns the account, which region holds the data, and how keys or managed identities are issued and rotated. Ask whether versioning and object lock are available in your chosen region, since these affect recovery and retention decisions later.

Network paths from application servers

Every application and background-job server must reach the storage endpoint, and that path must be open before the first upload. Map outbound routes, proxies, egress rules and DNS resolution from each node, including workers that handle uploads outside the web tier. Test uploads and downloads from every node type, because a single blocked worker will fail silently for some attachment types.

Certificates and trusted endpoints

Confirm that the storage endpoint presents a certificate your servers trust, especially if you use a private or self-hosted S3-compatible service with an internal certificate authority. Check the certificate chain, expiry dates and renewal owner. Mismatched certificates often appear as intermittent upload failures rather than a clear error, so verify them with the same client libraries Decidim uses.

Configuring the Active Storage service step by step

This sequence moves Decidim attachments from local disk to a private object storage container or bucket, with each step closed by a check so the cutover can be reversed if something fails.

  1. Confirm the version and back up first

    Confirm which Decidim minor version is running and whether it is one of the lines that still receives security updates, currently 0.32.x and 0.31.x. Take a full database backup and a copy of the existing uploads directory before changing anything, because the update guide stresses backing up the database first. Store both copies outside the application host. The step is done when a restore from the backup has been tested on a separate environment and the files open correctly.

  2. Create a private bucket or container

    Create the bucket (Amazon S3) or container (Azure Blob Storage or Google Cloud Storage) in the region your data rules require, with public access blocked at the account or project level. Enable versioning if your recovery policy needs it, and decide retention and lifecycle rules now rather than after files are written. Attachments should be served through the application or short-lived signed links, not through public URLs. The step is done when an anonymous request to a test object returns an access denial.

  3. Create a least-privilege credential

    Create a dedicated service identity limited to the one bucket or container, with permissions to read, write, list and delete objects under that location and nothing else. Do not reuse administrator keys or a shared personal account. Store the secret in your secrets manager and inject it into the environment at runtime. The step is done when a test call with this identity succeeds on the target bucket and is denied on another bucket in the same account.

  4. Add the Active Storage service to configuration

    Add a new service entry for your provider in the Rails storage configuration (commonly config/storage.yml), and point the environment file at the credential and bucket names through environment variables. Install the matching Active Storage gem for the provider and restart the application in a staging environment. Keep the existing local service in place so the default remains unchanged. The step is done when the application boots in staging and a rails console check can write, read and delete a test blob through the new service.

  5. Verify uploads and downloads through the app

    Using a staging account, upload a proposal attachment, a meeting document and an image through the Decidim interface, then download each one as a participant and as an administrator. Also check that Content Security Policy and CORS settings allow the browser to load previews or direct uploads from the storage host, since blocked requests usually show up as broken previews. The step is done when every file type you use opens correctly and the browser console shows no blocked requests.

  6. Migrate existing files

    Copy the files from the local storage directory into the new service using a checksum-verifying copy process, then confirm that the blob records in the database point to keys that exist in the new location. Run the migration in a maintenance window on a restored copy of production first, and record object counts and total size on both sides. Do not delete local files yet. The step is done when counts and checksums match for a sample and for the full set, and a spot check of old attachments opens from the new service.

  7. Switch the default service and keep a fallback

    Change the Active Storage default service setting to the new provider in production, keeping the local service defined so it can be selected again if a problem appears. Restart the application, then repeat the upload and download checks from the staging step against production with a test account. Monitor errors and access logs for the first working period, and only remove local copies once the retention plan for backups and rollback has been agreed. The step is done when new uploads land in the bucket and existing attachments render for all user roles.

How an upload and a download travel through the storage layer

A participant's browser sends a file to the Decidim app servers, which pass it to the Active Storage service that writes the bytes to the bucket or container. The database keeps only the attachment metadata, so it stores a reference, not the file. On download, the app server or a signed link brings the object back to the browser. The trust boundary sits between the public internet and the private storage network, and that is where you should confirm that the bucket is not exposed directly.

Upload and download paths across the public and private trust boundary.

Content Security Policy and CORS changes that uploads need

Once uploads leave local disk, the browser has to talk to the storage host directly, and that is where most post-migration breakage appears. Decidim serves pages under a Content Security Policy, which tells the browser which hosts may load scripts, images, styles, frames and connections. A bucket or container on S3, Azure Blob Storage or Google Cloud Storage is a different host from your Decidim domain, so its URLs are blocked until the policy names that host. The usual symptoms are attachments that upload but do not preview, images that render as broken boxes, and browser console errors that cite a refused load. Separately, a direct upload from the browser or a range request for a preview is a cross-origin request, so the bucket or container needs a CORS rule that allows your Decidim origin and the methods and headers the upload library sends. Without it, the request fails before any file reaches storage, and the error often looks like a generic network failure.

Plan these two changes together and test them against your own environment. Start by listing every storage host your deployment will produce, including signed URL hosts, regional endpoints and any CDN in front of the bucket, then decide which content types the browser fetches directly and which are proxied through Decidim. The directive names, the CORS field names and the allowed methods depend on the Decidim version you run and on the provider's current documentation, so confirm them against the Decidim release notes and the Active Storage guide for your provider rather than copying generic examples from forums. Check the Decidim installation documentation for the storage settings your version expects. Record the exact policy and CORS configuration you deploy, because each Decidim upgrade can change how uploads are requested and an overly broad policy weakens protection for the whole site.

Verify the result with a scripted test before opening the platform to participants. Upload a file of each permitted type from a clean browser session, open its preview, follow the download link, and confirm that the console shows no blocked requests. Repeat the test after each upgrade and after any change to the CDN or bucket policy. Ask your provider or integrator to show the final CSP header and CORS rule in writing, so your security team can review them with the rest of the platform configuration.

Choosing between AWS S3, Azure, Google Cloud and S3-compatible stores

Amazon S3 is the most direct target if your organization already runs workloads on AWS. AWS operates the storage layer, and AWS documents the durability, availability and retention features you can cite in a security or compliance review.

  • Durability and availability: S3 Standard is designed for 99.999999999% durability and 99.99% availability, with data stored across at least three Availability Zones.
  • Storage classes: Choose classes per bucket based on access pattern and retrieval needs. Confirm retrieval behavior and latency for each class before you set lifecycle rules.
  • Object Lock: Object Lock provides write-once-read-many storage with governance and compliance retention modes and legal holds. It works only in versioned buckets, so enable versioning first.
  • Compliance evidence: AWS states that Object Lock has been assessed by Cohasset Associates for SEC 17a-4, CFTC and FINRA environments. Ask your compliance team whether that assessment matches your own obligations.
  • Recurring cost: Storage, requests, data transfer and retained object versions are recurring charges. Ask partner quotes to separate one-time migration work from these monthly costs.

Before migrating live attachments, confirm the bucket region against your data residency rules, the IAM model, and the Active Storage service configuration and gem version for your Decidim release.

Mapping storage settings to Decidim and Active Storage fields

This table maps each storage setting or credential to its role in Decidim's Active Storage configuration, from the service name to the default service. Read it as a checklist: every row is a value you must set, name, or confirm against your own provider and environment before the first upload test. Confirm the exact key names and file locations against the Decidim version you run, since configuration keys differ between releases.

SettingRole in DecidimWhat to confirm
Service nameKey that Active Storage uses to refer to the provider, such as a named entry in the storage configuration fileUse one name per provider and keep it identical across the storage file, environment and deployment settings
ProviderSelects the Active Storage adapter for Amazon S3, Azure Blob Storage or Google Cloud Storage, or an S3-compatible storeConfirm the adapter gem and version your Rails stack loads, and whether your chosen provider is S3-compatible
Bucket or containerName of the bucket (S3, Google Cloud) or container (Azure) that receives attachmentsCreate it in the target region, decide on versioning and lifecycle rules, and confirm who can read and write it
Region or endpointRegion for AWS or Google Cloud, or a custom endpoint URL for S3-compatible storesMatch the region to data residency requirements, and confirm the endpoint and path style settings for self-hosted stores
Access key or identityCredential the application uses to write and read objects, such as an access key pair, a managed identity or a service accountGrant only the object actions Active Storage needs on the one bucket or container, and plan rotation for any static keys
Public or private accessDetermines whether attachment URLs are served directly from the bucket or through the application with signed linksDecide per attachment type; confirm that private files are never exposed through a public bucket policy
Default serviceNames the storage service Active Storage uses for new uploads unless a model overrides itSet it only after the test upload succeeds, and confirm how existing local files will be migrated or left in place
Browser origins (CORS)Lets browsers upload or display files directly from the bucket or container domainAdd only the Decidim origins that serve pages, and align the Content Security Policy directives with the same domains

Securing private attachments and backups in cloud storage

Object storage holds participant uploads, documents and exports, so its security settings matter as much as the Decidim configuration that points at it. The cards below cover the decisions that keep private attachments private, the identities that reach them, and a backup copy that survives a compromise of the primary store.

Private bucket defaults

Create the attachment bucket with public access blocked at the account or bucket level, and confirm that objects are only reachable through signed, time-limited URLs issued by Decidim. Check the setting after every change, because a bucket policy or ACL added later for another purpose can reopen access. Ask your team to test an anonymous request against a known attachment key and record the denied response.

S3 storage classes

Least-privilege identities per bucket

Give the Decidim application its own identity with read and write rights limited to the attachment bucket and its prefix, and no rights to list other buckets. Keep administrative credentials for bucket creation and policy changes with a separate operator identity. Rotate access keys on a schedule your security team sets, and prefer short-lived credentials where your platform supports them.

Encryption at rest and in transit

Confirm that the provider encrypts stored objects by default and decide whether your organization needs customer-managed keys with its own rotation and revocation process. Require TLS for every request, and deny requests that do not use it through the bucket policy. Record which key owns each bucket, because revoking that key is the fastest way to cut off access to stored data.

Versioning and Object Lock where supported

Enable versioning on the attachment bucket if you want to recover overwritten or deleted files. Object Lock in Amazon S3 requires a versioned bucket and offers governance and compliance retention modes plus legal holds. Azure and Google Cloud offer their own immutability and versioning options with different rules, so check each provider's documentation and confirm the feature is available in your region before you write a retention policy.

S3 Object Lock docs

Isolated backup destination

CIS Control 11, Safeguard 11.4, asks for a recovery copy kept separate from the systems it protects. In practice, store Decidim database dumps and attachment copies in a bucket or account that the application identity cannot delete from, with a different administrative path. An offline, off-site or separately owned destination fits this goal better than a second bucket in the same account with the same credentials.

CIS Control 11 specification

Deliberate public asset decisions

Serving public assets such as branding images directly from a bucket is a separate decision from storing private attachments. Put public assets in their own bucket or prefix, list every object that becomes reachable without authentication, and review that list before each release. Do not change the attachment bucket to public to fix a broken image, because that exposes participant documents along with the asset.

Why uploads, previews and downloads fail after the switch

This table lists the failures teams most often see after Decidim attachments move to object storage, with the likely cause and fix for each. Read it as a checklist: work through each row against your bucket, credentials, proxy and Decidim settings before you declare the migration complete.

FailureLikely causeFix and what to confirm
Previews or downloads blocked in the browserThe Content Security Policy does not allow the storage host for images, media or connections, so the browser refuses the request.Add the bucket or container host to the CSP directives Decidim uses, then reload and check the browser console for blocked resources.
Uploads fail from the browser with CORS errorsThe bucket or container has no CORS rule for the Decidim origin, or the rule omits the methods or headers the upload request needs.Add a CORS rule for your Decidim host covering the methods and headers your Active Storage direct upload path uses. Confirm the rule in the provider console.
Files not found or signature errorsThe region or endpoint in the storage config does not match where the bucket lives, or a custom endpoint is missing its path style setting.Compare the region and endpoint in the storage configuration with the bucket's actual location. Test one upload and one download before going live.
Uploads or listings deniedThe access key lacks list, read or write permissions on the bucket or container, often because the policy was scoped to a prefix or copied from another project.Grant the minimum set the application needs on that bucket: list, get, put and delete. Test each action with the same credentials Decidim uses.
Old attachments missing after the switchExisting files still sit on local disk and were never copied, or the migration ran without updating the stored service name for each record.Copy existing files to the new store, then verify a sample of records resolve. Confirm with your Decidim operator how Active Storage records map to the new service.
Large uploads rejectedA size limit in the web server, load balancer or proxy stops requests before they reach Decidim, or the application enforces its own maximum.Check the body size limit in the proxy and the attachment size settings in Decidim configuration. Test with a file just under and just over the limit.
Public files not visible to visitorsObjects are private by default, or the public access setting was applied to the wrong bucket or prefix.Confirm which files must be public, apply access only to those paths, and verify anonymous access in a private browser window.

Questions buyers ask before moving Decidim uploads to cloud storage

What drives the cost of moving Decidim uploads to S3, Azure or Google Cloud Storage?

The cost depends mostly on how much existing content has to move and how many environments must be changed. Cost components are the discovery and planning work, the Active Storage configuration, the Content Security Policy and CORS review, the copy of existing attachments, and the testing across environments. Volume matters because every attachment must be copied, checked and linked again. Each additional environment, such as staging, a test copy or a disaster recovery site, adds configuration and test work. Ask any partner to price these components separately in the written scope, and ask which of them are one-time and which recur, such as the cloud storage bill itself, which you pay directly to the provider.

How long does a Decidim storage migration take?

The duration depends on the scope agreed in writing, not on a fixed figure. The main variables are the number of attachments and their total size, the number of environments, whether the platform is already on a supported Decidim version, and how much CSP and CORS work the public pages need. Copy time for large file sets can run long on its own, so it should be planned as a separate step with a window for verification. Ask for a timeline that lists each phase, its entry and exit checks, and the environments it covers. Any date given before a staging copy has been tested should be treated as provisional.

What do we need to provide before the work starts?

Before work starts, the client normally provides the following:

  • Access to the cloud account, with a named owner for buckets, identity and keys
  • DNS and network details, including the hostnames used for public asset URLs and any private endpoints
  • A staging copy of the Decidim database and file store that reflects production
  • A named approver who signs off the test results and the cutover plan
  • Current backup procedures and a restore test, since the database must be backed up before any upgrade or structural change

Missing items usually show up as delays in the middle of the work, so confirm each one during scoping.

Can our in-house team move Decidim uploads to cloud storage without a partner?

Yes, a capable in-house team can do this, provided it has Ruby on Rails and Decidim operations experience and time to test. The work involves Active Storage provider configuration, a copy of existing blobs, updates to Content Security Policy and CORS settings, and a rollback plan. Decidim's own installation and update documentation describes ActiveStorage as part of a production setup, so the starting point is documented. The questions to answer honestly are whether the team can run a staging rehearsal, who owns the cutover, and who will handle problems after go-live. A partner is most useful when those answers are unclear or when several environments must change together.

Does the choice of S3, Azure or Google Cloud Storage change the work?

The provider changes the configuration and the access model more than the Decidim work itself. Each provider has its own Active Storage service definition, authentication method and endpoint format, so the settings and the test cases differ. Public asset delivery, signed URLs and CORS rules are configured in provider-specific ways, which affects the CSP review. Storage classes, versioning and object lock options also differ by provider, and the retention needs of your organization should decide which options are enabled. Confirm the exact configuration keys for your Decidim version in the official documentation, and do not copy settings from another provider's example without testing them.

What should we check in Content Security Policy and CORS after the move?

Check that browsers can load images, documents and downloads from the new storage host without weakening the policy more than necessary. A move to a separate host usually requires adding that host to the allowed image, media and connect sources, and to CORS rules where the browser fetches files directly. Test each attachment type used on your platform, including uploads from the admin panel, participant-submitted files and any embedded media. Also test the error paths, because a blocked request often looks like a missing file to a participant. Record the final policy and CORS rules as part of the handover so that later upgrades do not reset them silently.

How do we handle existing attachments and size limits during migration?

Existing attachments must be copied, verified and relinked before the old disk storage is retired. Plan a checksum or count comparison between the source and the target, and keep the local files until the verification passes and the rollback window closes. Size limits matter in two places: the upload limit in the application and any limit on the reverse proxy or load balancer in front of it. Large uploads can fail at either point, so confirm both values for the new setup. Ask your partner or team to list which limits they changed and to test an upload close to the maximum allowed size.

Is there a backup and recovery requirement for uploads stored in the cloud?

Yes. Moving files to cloud storage does not replace a backup plan, and the database and file store must be restored together to produce a consistent platform. Decidim's update guidance says to back up the database before upgrading, and the same discipline applies here. Confirm the provider's durability and versioning options, the retention period your policy requires, and whether a copy of the bucket must sit in a separate account or region. Test a restore of both the database and a sample of files before cutover, and document who can perform that restore.

How DeployOpen scopes and delivers the storage move

DeployOpen scopes the storage move as a fixed-scope engagement, with the scope, deliverables and timeline agreed in writing before any work starts. For this topic, the written scope should name the storage provider chosen for the Active Storage service, the buckets or containers and their access model, the Content Security Policy and CORS changes needed in the browser, the attachment size limits you intend to keep, and the cutover plan for existing files. A quote follows from that scope, so the more precisely your team defines these items up front, the more accurately the work can be priced. DeployOpen does not hold any cloud provider partner status for this work, and the storage account, billing and data stay in your own cloud accounts or data centers.

Delivery covers the parts that most often break after go-live. Testing checks that uploads and downloads work for each attachment type Decidim accepts, that previews and direct links render under your Content Security Policy, that browser requests succeed under your CORS rules, and that public assets are served only where you intended. The testing is run against the environments you provide, including staging, and the results are documented so your security and operations staff can review the configuration and the reasons behind each setting. Ask whether the scope includes a rollback path and a documented method for verifying that old local files and migrated files match.

After delivery, the configuration becomes an operational item rather than a one-time project. Ongoing support, Decidim minor version upgrades and periodic re-testing of browser rules can be covered by an optional retainer, which is priced separately from the fixed-scope build. Before you agree to a retainer, confirm which Decidim version line you will run, since each upgrade can change how Active Storage and its related settings behave, and confirm who in your organization owns the storage account, its access keys and its backups. Your own team should also be able to explain the configuration to an auditor without DeployOpen in the room.

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.