Start a Project

Magento 2 Amazon S3 Extension

Introduction

Amazon S3 Extension for Magento 2 (https://store.webkul.com/magento2-amazon-s3-extension.html) provides the users to store the static files and media content to be uploaded on the Amazon S3 bucket and get them retrieved directly from the S3 bucket. This module uses Amazon S3 for file storage and CloudFront for content delivery (CloudFront URL). As a result, due to the elimination of unnecessary pauses, the site or page will load faster and cater to huge traffic.

Amazon S3 (Simple Storage Service) is a cloud storage service offered by AWS (Amazon Web Services). Using the module, the store admin can upload downloadable products, media files, product content, images of all product types from their local disk to the Amazon S3 server.

Note:

Features

Installation

Unzip the respective extension zip and then merge packages folders into the project root directory.

To complete the setup, run the commands mentioned below:

php bin/magento setup:upgrade

composer require aws/aws-sdk-php

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

In Addition, Give permissions to the Magento directory by Enabling Requisite Commands.

sudo chmod -R 755 /home/magento/magento2

sudo chown -R magento:magento /home/magento/magento2

Additionally, after running the aforementioned commands, browse to ->System->Cache management in the Magento admin panel to flush the cache.

That’s it, now just execute the project on your specified domain.

Setting Up Amazon S3 Server Credentials

(i) To start with, create a new AWS account by using Sign-up. 

(ii) And then log in to your AWS account by Sign-in.

(iii) After your account has been successfully createdselect the S3 among the available AWS services or you can search for an S3 service in the search box.

(iv) This will take you to a page where you can view your created buckets or create a new bucket. To create a new bucket, choose to create a bucket from the drop-down menu.

(v) After pressing the Create bucket button, you’ll be taken to the Create bucket tab, where you’ll need to fill in all of the necessary information to create a new bucket. Then, at the bottom, press Create bucket.

Note:- Make sure to uncheck the Block all public access”.

(vi) Here you can upload the files and create a folder to save the data. Also, you can view the saved data.

(vii) Click IAM under Security, Identity & Compliance to create an access key ID and a secret access key.

(viii) Click Users in the IAM dashboard to view and delete existing users, as well as add a new one.

Note:

Amazon S3 Extension Configuration

The admin can customize the module settings after installing the extension by going to Stores > Configuration > Amazon S3 as seen below:

Open the Magento Admin Panel and fill in the following information.

Check the availability of the bucket and then click Create Distribution.

Create Distribution:  To create an AWS CloudFront Distribution Id, click the Create Distribution option.

Check Status: To get the Domain Name (URL) and Distribution Status, click the Check Status button.

Distribution Id: After saving the configuration, the distribution id will appear.

The Static View File Settings part of the admin settings requires the admin to configure fields like Enable for Static View Files, Bucket Name, Region, and Cache-Control, as seen in the image above.

You can check the created distribution ID in your AWS account or create a new one as shown below:

Under the configuration option, navigate to Advanced>system>storage configuration media. For setting up the Media Storage Configuration.

Now, click the Synchronize button and wait a few seconds to see whether the synchronization was successful. And then “Save Config“.

To configure the Base URLs settings, go to the web sub-menu option under the general setting option.

Furthermore, once the CloudFront configuration is complete, you’ll need to replace the bucket URL with the CloudFront URL to serve files from CloudFront.

The content is now served from the S3 bucket. So, this is all for the Amazon S3 extension module of Magento.

Thanks For Reading!

At last, we hope it works for you! And during this blog, you have found something valuable.

Keep in touch!!

In case of any help or query, please contact us or raise a ticket.

Exit mobile version