Uploading Media Files to Amazon S3 server

1726 views July 9, 2022 admin 2

To Install Amazon Library , run this command

composer require aws/aws-sdk-php

To sync all your product image media files and category image media files to the Amazon S3 server you must have to follow the below steps.

Note: Before using Amazon S3 cloud storage, take the backup of all the media files.

1. First, enable the extension from the back-end and setup your Amazon S3 credential details. Run all the commands to your Magento Root Path.

2. Run below command to upload your existing media files such as images, catalog, products, etc. to the Amazon server.

php bin/magento amazons3:export

First thing you need to do is to run export command before you run enable command to sync all existing media to S3, To use export command, first it would verify that you haven’t run enable command.

If you have already run enable command first, then you should run disable command first before running export command.

3. To enable S3 integration run below command

php bin/magento amazons3:enable

Once you run enable command than and only than you will be able to use our amazon S3 extension functionality, and using this command you need to set base media URL in system configuration (System->Configuration->General->Web-> Base URLs / Base URLs (Secure)) to access all the S3 media in system as per shown in below screenshot.


If you do not see any URL in base media field after running enable command, then you need to set that URL manually as per below screenshot.


4. To disable S3 integration run below command

php bin/magento amazons3:disable

If you do not want to use S3 media anymore, than you can run disable command. Using this command, S3 base media URL will be removed from system configuration.
You can also remove the base media URL manually.

Once the upload is completed, you will be able to see all the product images in the Amazon S3 server as shown below.

You can also, see the before and after URL of images uploaded on the Amazon S3 server.


Was this helpful?