How Magento Open Source Amazon S3 remote storage works
A self-hosted store often reaches a point where product images, generated thumbnails and other media files grow faster than the web nodes or the database can comfortably hold them. The remote storage module, which the topic brief places in the 2.4.2 release line and later, moves those media and generated files to Amazon S3 so that the store's local disks and database stop carrying them. The module is configured through the command line rather than the Admin, which means the exact configuration steps and commands must come from Adobe's documentation for the release you run. This page does not supply command syntax, and your team should verify every command, configuration key and option against that documentation and against a staging copy of your own store before changing production.
Before any configuration, decide where media currently lives and who depends on it. Confirm whether your media is stored on the file system of each web node, in the database, or in a shared mount, because the migration path differs for each. The team should also confirm which Magento Open Source release line is installed, since the module's behavior, supported options and compatibility with the other components in your stack are tied to that line. Check the supported combinations in Adobe's system requirements for your release before you plan the change, and record the storage-related settings you intend to change so that you can roll them back.
Plan for the parts of the change that affect more than the bucket itself. Every web node must read and write media through the same storage configuration, so the change has to be rolled out as one release rather than node by node. Image URLs, the CDN origin, backup scope and the file functions your custom code calls all change with the new storage location. The PHP file function caveats that Adobe notes need to be checked against your extensions and custom modules, because code that assumes a local path may fail once the file is no longer on disk. Ask Adobe's documentation and your own testing team to confirm the list of affected functions for your release, and include a restore test for the S3 bucket in your plan.
What you need before enabling Amazon S3 storage
Enabling S3 storage touches the Magento release line, the PHP and service stack, and the AWS account your web nodes will call. Work through the platform side and the AWS side together, because a mismatch in either blocks the module or breaks media delivery on every web node.
Confirm the release line includes the module
The remote storage module is available from Magento Open Source 2.4.2, so the store must run that release or later. Pick the target line first, then check its lifecycle dates, since the S3 setup will need to survive future patches and upgrades. Record the exact patch level in your runbook so the team can match it in staging and production.
Lifecycle policyMatch the Adobe-listed stack
Adobe supports only the listed combinations of PHP, database, search, cache, queue and web server for each release. For 2.4.9 that means PHP 8.5, MySQL 8.4 or MariaDB 12.3 (recommended) or 11.8, OpenSearch 3, Redis or Valkey 9, RabbitMQ 4.3, Composer 2.10 and nginx 1.30 on Linux x86-64. Check the versions against the system requirements page before changing anything on the stack.
System requirementsCheck Varnish on the 2.4.8 line
If the store runs 2.4.8-p5 instead, the listed stack includes PHP 8.4 or 8.3 and Varnish 8. Varnish is the full-page cache accelerator Adobe documents for self-managed installations. Confirm that the cache layer is planned and versioned alongside the S3 change, because cached media URLs and invalidation rules affect how the remote storage behaves across nodes.
Varnish cache guideConfirm PHP extensions and module state
Before enabling the module, confirm the PHP extensions it needs on every web node, and check that the Composer packages installed in the build match the release. Run a staging install with the module enabled and a copy of the media directory so you see missing extensions or dependency conflicts before production. Document which extensions were added so future image or PHP upgrades do not drop them.
Create the bucket and region plan
Confirm with the AWS team the bucket name, the region, and whether the bucket is dedicated to this store or shared with other workloads. Decide on the bucket layout and prefixes for media and generated files, and keep staging and production in separate buckets. Region choice also affects latency from web nodes and the cost of data transfer, so ask for both to be recorded in the design.
Scope IAM to the store only
Create a dedicated IAM identity for the store with only the object actions the module needs on that bucket and prefix. Avoid broad administrator policies and long-lived access keys on web nodes. Ask the security team how credentials will be issued, rotated and revoked, and whether instance roles or another short-lived mechanism are available in your environment.
Set encryption and the network path
Confirm the default encryption setting for the bucket and whether a customer-managed key is required, including the key policy that lets the store identity use it. Then map the network path from each web node to S3, whether over the public endpoint, a VPC endpoint or a proxy, and confirm that egress rules and DNS allow it. A blocked path shows up as broken media on one node only, so test every node.
Configuration sequence for moving media to S3
This sequence moves product images and generated files from the local filesystem and database storage into an Amazon S3 bucket without breaking the storefront or the admin, and it leaves a checked record at each stage.
Back up and confirm the release line status
Before changing anything, take a full backup of the database, the media directory, and the environment configuration, and store it outside the web tier. Confirm the installed 2.4.x release and its end of regular support date against Adobe's lifecycle policy, because the remote storage module and its CLI behavior depend on the release line in use. Done means a restorable backup exists, has been test-restored to a non-production copy, and the release line status is written into the change record.
Disable database media storage first
Switch the media storage setting away from the database before connecting S3, so that new writes do not land in two places during the cutover. Confirm the exact configuration path and CLI command for this step in Adobe's remote storage documentation rather than repeating it from memory, and run it in a staging environment first. Done means the setting reads back as file system storage in a staging copy and the change is recorded for production.
Confirm the remote storage module is enabled
Check that the remote storage module is present and enabled in the codebase and in the module status list on each web node, since a module enabled on one node but not another causes inconsistent image behavior. Run the module status check from the project root and compare output across environments. Done means the module shows as enabled on every node in staging and production, and the output is saved with the change record.
Set the S3 connection and bucket through the CLI
Set the storage driver, bucket, region, and credentials using the setup commands and configuration keys documented by Adobe for the remote storage module, and confirm each key name against the current documentation for your release. Store access keys through your secrets mechanism or an instance role rather than plain text in shared configuration files, and restrict the IAM policy to the single bucket and the actions the store needs. Done means the configuration reads back correctly on each node and the bucket policy has been reviewed by the person who owns AWS access.
Migrate or sync existing media
Copy the existing media directory to the bucket using the sync method Adobe documents for the module, and run it on a copy of production data first to measure transfer time and catch path mismatches. Keep the local media directory intact until verification is complete. Done means object counts and total size in the bucket match the local source for the media directory, and a sample of files compares equal by checksum.
Test a product image from the bucket URL
Open a product page on staging and confirm that the image request resolves to the bucket or the configured public base URL, not the local media path. Check the browser network panel for failed image requests and confirm the same behavior in the admin product grid. Done means a test product image loads from the bucket URL on both storefront and admin, and no image requests return errors.
Verify generated files and logs
Trigger an action that generates a file, such as a catalog export or a resized image cache entry, and confirm the file appears in the bucket under the expected path. Then review the system and exception logs for storage-related errors after the test run. Done means a generated file is written to S3, it can be downloaded through the admin, and the logs contain no new storage errors over a full test cycle.
Confirm multi-node behavior before production cutover
Repeat the image and generated file checks from each web node, and where a CDN sits in front of the bucket, confirm cache invalidation and origin settings with the team that operates it. Adobe's guidance on multi-node layouts and CDN delivery should be confirmed for your release before the production window. Done means every node serves identical image URLs, the CDN returns current content, and the production cutover checklist is signed off by the operations owner.
How requests reach media in S3 and the CDN
The diagram starts with a shopper request that reaches the CDN or the web tier. Web nodes write generated files to the S3 bucket, and the storefront reads media back through the configured base URL, so the CDN can serve it. Admin users and cron jobs write to the same bucket, which is why they must share one storage configuration. Check the trust boundary between your network and AWS, and confirm which IAM identity each web node uses.
Shoppers, admins and cron jobs share one S3 bucket across the trust boundary.
Which files and settings move to S3
This table maps each data type that Magento Open Source writes to disk onto its location before and after the S3 change, along with the component that reads it and the owner who approves the move. Read each row as a checklist item: confirm the exact target prefix and any excluded file types in the release documentation before you change anything.
| Data type | Before (source location) | After (target S3 prefix, to confirm) | Consuming component and approver |
|---|---|---|---|
| Product and category media | Local media directory under the Magento media path, or database storage if enabled | Media prefix defined by the remote storage module, to be confirmed in the release documentation | Storefront and admin read it; catalog owner approves |
| Generated image cache | Local media cache directory created on first image request | Cache prefix within the S3 bucket, to be confirmed; may change how images are regenerated | Storefront and CDN serve it; platform engineering approves |
| Export files | Local var export directory produced by admin export jobs | Export prefix in the bucket, to be confirmed; access should follow admin roles | Admin users and cron download it; data owner approves |
| Import files | Local var import directory where uploaded CSV files are staged | Import prefix in the bucket, to be confirmed; restrict write access to admin processes | Admin and cron read it; merchandising lead approves |
| Other generated files (sitemaps, downloadable products) | Local directories under pub and var written by cron and admin actions | Prefixes to be confirmed per file type, including any types the module excludes | Storefront, cron and CDN consume them; SEO or product owner approves |
| Database media storage (if in use) | Media stored as database content before the change | Migrated to the remote target only after database storage is disabled, per Adobe's documented order | Database administrator and platform owner approve the cutover |
| Configuration and credentials | Environment and admin configuration holding storage settings | Bucket, region and credentials set through CLI configuration, kept out of shared files | Security team approves; credentials owner rotates keys |
What changes for multi-node web tiers
Moving media off local disk matters as soon as several web nodes serve one store. When media and generated files live on a single node's disk, every other node cannot see uploads, product images or generated assets written there. With remote storage in Amazon S3, every node must read and write the same remote location, so a file written by one node has to be visible to all of them. Before you enable the remote storage module, map which nodes handle admin uploads, import jobs, cron-generated files and storefront requests, and confirm that each of them can reach the same bucket with the same configuration. The exact multi-node behavior depends on your release, so confirm it against the remote storage documentation for your version before you plan the rollout.
Shared writes, cache invalidation and deployment pipelines each need their own plan. Writes from background jobs and admin actions can land on any node, so decide which node runs cron and indexers and how you will detect a failed upload. Cache invalidation matters because a changed image or regenerated file can be served from a stale cache even when the object in S3 is correct. Your deployment pipeline must also keep the storage configuration identical across nodes and must not depend on a local media directory that no longer receives new files. Plan a test that uploads a product image on one node and confirms it renders on every other node and through the cache layer.
Varnish sits in front of these nodes. Adobe documents Varnish as the full-page cache accelerator for self-managed installations, so the cache decides which requests ever reach a web node and how long a cached media response survives. Check which media paths Varnish caches, how purges are triggered after a change, and whether the cache tier and the web nodes agree on the same cache configuration. Ask your Magento partner or your own team to confirm these steps in your environment, using the Use Varnish cache guide as the starting reference.
Choosing a delivery path for single node, multi-node and CDN setups
On a single web node, the main decision is whether the store keeps its media base URL pointing at the local web server or moves it to the S3 bucket. Because one server writes and reads every file, the remote storage module can be verified end to end without any cache coordination. The team still needs to confirm that the media base URL in the store configuration matches the public address that browsers will request, and that the web server does not also keep stale copies that mask a broken upload path.
- Media base URL: Decide whether product images are requested from the store domain or directly from the bucket hostname, and record the choice in the environment configuration.
- Cache purge behavior: Confirm what happens to cached images after an administrator replaces a product photo. A single node usually needs only the normal cache flush, but the team should test it.
- Cache headers: Check the headers the bucket or web server returns for media files, including expiry and content type, before assuming the default is acceptable.
- Write path test: Upload a product image, generate a thumbnail, and confirm the object appears in the bucket with the expected key prefix.
- Likely failure: Files are written to S3 but the storefront still points to a local path, so images load only until the local copy is removed during a deployment.
Before sign-off, ask the platform team to show the configured media URL on a product page and the matching object in the bucket.
When several web nodes sit behind Varnish, every node must resolve media to the same location, and every cached response must expire when the underlying file changes. Adobe documents Varnish as the full-page cache accelerator for self-managed installations, so the purge path from the application to Varnish becomes part of the media design. The team must decide how the nodes share configuration, which hostname browsers use for media, and whether Varnish caches media responses at all.
- Shared configuration: Confirm that all web nodes read the same remote storage settings from the shared configuration, so no node writes or reads media from a different location.
- Cache purge behavior: Test that replacing an image triggers a purge of the affected URLs in Varnish on every node, not only the node that handled the upload.
- Cache headers: Set expiry values that match how often product media changes, and make sure Varnish honors them without caching error responses.
- Load test with changed media: Replace an image during a load test and check that all nodes serve the new file within the purge window the team has agreed.
- Likely failure: One node serves a cached old image after an update because the purge reached only part of the tier, which appears to customers as inconsistent product photos.
Ask the team to show the Varnish configuration for media paths and the logs from a purge triggered by an image change.
Adding a CDN changes the origin, the cache layers and the purge flow at once. The CDN origin must point to the bucket or a controlled hostname in front of it, and the store must generate media URLs that the CDN serves. The team must decide whether the CDN is the public media hostname, how its cache is invalidated when a file changes, and whether the bucket is reachable only through the CDN. The team should confirm each of these with the CDN and bucket documentation for the services it has chosen.
- Origin definition: Decide whether the CDN origin is the bucket endpoint or a hostname the team controls, and document which one the store uses.
- Media base URL: Confirm that the public media URL points to the CDN hostname and that the bucket is not exposed directly to customers unless that is intended.
- Invalidation path: Test that replacing a file invalidates the CDN object and that Varnish, if present, does not hold a copy that outlives the CDN purge.
- Cache headers: Verify the headers the origin returns, since the CDN and any intermediate cache will apply their own rules based on them.
- Likely failure: The CDN keeps serving a file after it was replaced in the bucket, or the store links to a bucket hostname that bypasses the CDN and loses its caching and access controls.
Before launch, ask for a test of an updated product image through every cache layer, with the expected invalidation result written down.
Securing the S3 bucket and the store's access to it
The bucket holds product media and generated files that the storefront serves to every visitor, so its permissions decide who can read, change or delete them. The controls below work together: the web tier should hold only the rights it needs, public exposure should be limited to intended media, and every access should leave a trail your team reviews.
Least-privilege IAM policy for the web tier
Give the web nodes an IAM role that can read and write only the object prefixes Magento uses for media and generated files, plus the list calls the remote storage module needs. Leave out bucket administration, policy changes and deletion of the whole bucket. Because every web node in a multi-node layout uses this role, a broad policy multiplies the damage from one compromised server. Confirm the exact action list against the module version you install, since it can change between releases, and test the policy in a non-production bucket before rollout.
Adobe system requirementsBucket policy limited to store roles
Write a bucket policy that allows access only from the principals that run the store, such as the web tier role and the deployment role used for maintenance. Deny requests that do not use TLS, and deny delete actions for everyone except a narrow administrative role. A bucket policy acts as a second check on the IAM policy, so a misconfigured identity policy elsewhere in the account does not silently open the bucket. Review the policy whenever you add a node pool, a CI runner or a new service that touches media.
Server-side encryption to confirm
Confirm with your AWS account team and the module documentation which server-side encryption option the remote storage configuration supports, and whether it works with the key type you plan to use. If you choose a customer managed KMS key, add key policy grants for the web tier role and plan for the request cost and throttling that KMS calls can add under load. Record the decision, because your assessor will ask where data at rest is protected and who can use the key.
Restricting public read access
Keep the bucket private by default and serve only intended media to shoppers, either through the CDN origin access controls you configure or through URLs the store generates. Avoid public ACLs and broad bucket policies that grant anonymous read on the whole bucket, because generated files, exports and backups may share the same bucket. Block public access at the account and bucket level, then open only the prefix that holds product images, and check the result with an external scan after each change.
Logging and review of bucket access
Turn on server access logging or AWS CloudTrail data events for the bucket, and send the logs to a separate account or locked bucket so the web tier cannot alter them. Set a review routine for unexpected principals, denied requests, bulk downloads and changes to the bucket policy. Ask your team which alerts they will act on before you turn logging on, because raw logs for a busy catalog grow quickly and cost money to store and query.
Secret handling for AWS credentials on web nodes
Prefer an instance role or workload identity over static access keys on web nodes, so no long-lived secret sits in the environment file or the Magento configuration. If static keys are unavoidable, keep them out of version control and shared configuration, load them from your secrets manager at deploy time, rotate them on a schedule, and limit them with the same IAM policy. Check that the Magento configuration and logs do not print the key values. Discuss the credential approach with your assessor, since it affects how the store's PCI DSS scope and Content Security Policy review are documented.
Common failures when S3 remote storage is enabled
This table lists the failures teams most often hit after moving Magento Open Source media and generated files to Amazon S3, with the cause and the fix for each. Read it before cutover and again during testing, since most rows trace back to a missed step in configuration order, base URL handling or cache clearing. The main takeaway is that remote storage problems are usually configuration and sequencing problems, not storage problems.
| Failure | Likely cause | Fix |
|---|---|---|
| Images return broken links after the base URL change | Stored media paths or the configured media base URL still point to the old host or path, so the storefront builds links to a location that no longer serves them. | Confirm the media base URL in the remote storage configuration matches the public S3 or CDN origin, then flush caches and regenerate cached media references. |
| Admin-generated files are missing | Files written by admin actions such as exports or generated assets went to local disk or a path the remote adapter does not sync, so the S3 bucket never received them. | Test each admin export and generated file type after configuration, confirm objects appear in the bucket, and check write permissions for the IAM role used by the web nodes. |
| Cache serves old media after migration | Full-page cache, browser caches and cached image references still hold URLs or files from before the switch to remote storage. | Clear the full-page cache and application caches after the storage change, and confirm the Varnish or CDN layer is purged for affected media paths. |
| One web node shows different images than another | Some nodes still read media from a local directory or use an older configuration, so each node resolves the same path to a different source. | Apply the same environment configuration on every web node, confirm all nodes read the same bucket, and remove any leftover local media directories that could be served instead. |
| PHP file function errors on remote paths | Some PHP file functions behave differently or are unsupported when a path points to a remote stream rather than local disk, which can break code that calls them on media or generated files. | Pull the exact list of affected functions from Adobe's remote storage documentation, check custom modules and extensions against that list, and do not rely on assumptions about which functions are safe. |
Questions buyers ask before enabling Amazon S3 storage
How much effort does Amazon S3 media storage take, and what drives it?
Effort depends on the size of the media library, the number of web nodes, whether a CDN sits in front of the store, how much custom code writes files directly, and which Magento Open Source release line you run. A large media library takes longer to copy and verify than a small one. Every web node must read the same storage, so a multi-node layout adds configuration and test cases. A CDN adds origin settings and cache invalidation checks. Custom modules that write or read media paths with PHP file functions need review. The remote storage module is available from 2.4.2, and your installed version sets which settings and compatibility checks apply. Ask for the effort split by these drivers in the written scope, and confirm figures against your own environment.
Can our in-house team enable S3 storage without a partner?
Yes, if the team has Magento administration experience, AWS skills for buckets, IAM policies and networking, and time to run a staging rehearsal with full verification. The work includes CLI configuration, disabling database media storage first, copying existing media, and testing the storefront, admin panel and any cron-generated files. The main risk is rarely the command line. It is usually the AWS permissions model or a gap in the test cycle, especially when custom code writes files directly. An in-house team should also decide who owns the bucket after go-live, because every image the store serves depends on it.
What do we need to provide before the work starts?
Expect to provide AWS account access with rights to create or use an S3 bucket, IAM roles for the store with permissions limited to the media paths it needs, and a staging environment that matches production in Magento release, PHP version and web node layout. You also need a maintenance window for the final switch, access to the admin panel and the code repository so custom modules can be reviewed, and a named owner who approves test results. Confirm the exact permissions and network paths with your cloud team before the scope is signed.
What is one-time work and what recurs after S3 storage goes live?
The one-time work covers the initial media copy, configuration changes, custom code review, CDN adjustments and the staging and cutover tests. Recurring work includes watching bucket access, error logs and storage charges, reviewing changes to S3 and IAM settings, and retesting after each Magento patch or upgrade. Upgrade testing is the item teams most often underestimate. Adobe recommends upgrading every patch cycle to stay secure and PCI compliant, and each upgrade can affect how modules handle remote media. Ask a partner which items sit in the fixed scope and which move to a retainer for ongoing support.
What should we ask a partner to include in a written quote?
A written quote should state the Magento release and environments covered, the number of web nodes and the approximate media volume assumed, the AWS resources to be created or changed, and the CDN and cache changes. It should list the custom code reviewed, the staging rehearsals, the cutover window and the rollback plan. Separate one-time work from recurring support, and state what evidence you receive at the end, such as a media count reconciliation and test results. Ask how the partner handles a file-function issue found late in testing, and who decides whether to proceed. Confirm every figure in the written scope before approval.
Which custom code and web tier settings could break when media moves to S3?
Custom code is the most common source of trouble. Modules that assume media and generated files sit on the local disk may call PHP file functions on those paths and fail or behave differently once storage is remote. Cron jobs, import scripts and export tools that write files locally need the same review. On the web tier, every node must point at the same storage configuration, and CDN origin settings and cache invalidation must match the bucket layout. Review the PHP file function caveats Adobe documents for your release, then test these paths in a staging environment that uses the same node count and CDN setup as production.
How DeployOpen works on this
DeployOpen plans and implements self-hosted Magento Open Source stores inside your own cloud accounts or data centers, so media and generated files can move to Amazon S3 under your control. The work covers the configuration, the multi-node web tier, CDN delivery and the file function checks that Adobe documents, with each step agreed in writing before build starts.
How we scope
- Written scope lists the S3 bucket, IAM access model, region and the media and generated folders to migrate.
- Current media storage, database media records and the planned order of disabling database storage are documented.
- Multi-node web tier, CDN origin and any custom modules that write files are mapped before a quote follows.
How we build
- Remote storage is configured through the documented CLI commands in a staging copy of your store first.
- Media and generated files are migrated and checked against the storefront before the cutover window is confirmed.
- PHP file function usage in custom modules and themes is reviewed and reworked where Adobe's caveats apply.
How we hand over
- Deliverables include the configuration record, bucket policy notes, runbooks for cutover and rollback, and test results.
- Your team receives a checklist for verifying new uploads, CDN delivery and cache behavior after each release.
- Knowledge transfer sessions cover how the storage settings interact with deployment pipelines and multi-node sync.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Confirm with your team how patch upgrades in each release cycle will be retested against the S3 configuration.

