No image

aMiSTACX S3 Titanium Magento Configuration Tips

AWS S3 for Magento Configuration and Performance Tips

With the release of our S3Rocket Module ,S3Sonic Module, and Ramjet for AWS S3 [aka The S3 Titanium Suite], horizontal scaling is now possible when used in conjunction with RDS, an AWS Load balancer, and with an AWS auto scale group.

These modules should be administered only by admins and developers with extensive knowledge of both Magento and AWS.

With Luma Sample data we have achieved load times as fast as 1.4 seconds [out-of-the-box], and quality speed/quality scores in the high 90s. We also have several customers that have up to 1 million catalog items using the aMiSTACX S3 Titanium configuration.

TROUBLESHOOTING / CONFIGURATION

Should you not see the aMiSTACX S3 modules after a fresh CloudFormation install [it is possible], then first follow these steps.

From CLI using the aMiSTACX helper script:

cd /var/www/magento

sudo ./amistacx.sh

Some Images NOT appearing

It is best to run this prior to S3Rocket Sync with S3 for the first time:

sudo php bin/magento catalog:images:resize

Magento Developer Docs Ref:

Tip: Sync should be performed from CLI not from the admin dashboard.

e.g. sudo php bin/magento s3rocket:bucket:sync

PERFORMANCE

S3Rocket Custom S3 Domain

Tip 1. – You need to have Cloudflare S3 CNAME set to CDN ON [Orange Cloud]. If you do not, then you will get mixed content warnings. Also make sure the S3 domain that Cloudflare is using has the Cloudflare SSL set to FULL.

Very Important! Wait about 15-30 minutes for Cloudflare to kick in before you upload any Magento media content; otherwise, you might get certificate warnings. For example, say Magento sets a path to a media image that looks like this:

https://s3rtest.awsamistacks.com/catalog/product/6/4/640.png

But when Cloudflare CDN has not fully propagated, you will get served a URL that looks like this:

https://s3rtest.awsamistacks.com.s3-us-west-2.amazonaws.com/catalog/product/6/4/640.png

Plus you will get a certificate warnings.

Tip 2. Static Content Deployment to S3

Warning! Not all themes or components are compatible with static deployment.

Prior to deploying static, make a full image and or database backup, also make sure you can connect to your database prior to upload.

S3Rocket Deploy CSS to S3

When used in this configuration, we have removed Redis caching, and set CSS and JS settings in the Magento Console as follows:

Magento 2.2.x Developer CSS JS Settings

Note: Make sure you test this on Dev environment first. Also, make sure you deploy your media files first, take a backup, and then test deployment of Static content to S3.

Additionally, when deploying static content to S3 you will need to follow the following steps to ensure success:

From CLI:

cd /var/www/magento

sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:upgrade
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:di:compile
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:static-content:deploy -f
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento cache:enable

*Must use the -f switch.

Static Rollback

If you need to rollback static to local, perform the following:

Connect to the Magento database, and find this entry in the core_config_data table:

s3/content_configuration/static_content

Set the value from 1 to 0

Then from Magento:

cd /var/www/magento
sudo php bin/magento cache:clean
sudo chown -R www-data:www-data /var/www/magento
sudo php bin/magento setup:static-content:deploy -f

Tip 3. Image Compression

S3Rocket as of version 1.0.6 introduced an option to compress images and make use of WebP. Select one or the other.

Magento 2.2.x S3Rocket Image Compression

Advanced Configurations

S3Rocket S3 Rocket Security for Magento

Enable S3 Logger : Tracks sync process for errors and success.

Sync Product Images Automatically: So you don’t have to re-run image re-size command. S3Rocket will do it for you on each page.

Allow from IP: Restricts access to S3Bucket by magento server IP. Designed to prevent access to raw URLs.

Allow from Referrer: Restricts access to S3Bucket by domain URL. e.g. https://demo.awsamistacx.com is only allowed to serve S3 bucket content.

S3T TOOLS

Sync to S3 via CLI. This comes in handy for mega image catalogs – like 150K +.

cd /var/www/magento

sudo php bin/magento s3rocket:bucket:sync

Note: It will sync the image path as defined in the S3Rocket module!

If you decide to use compression, then in S3R v1.0.6 you have the option to sync with CLI.

cd /var/www/magento

sudo php bin/magento s3rocket:bucket:sync --with-compressed

Note: Optimized images will use a special path on S3 and only be retained on S3. No local copy.

LAUNCH

Paying attention to details and making sure you follow your aMiSTACX admin guide, and of course your own experience, will help make sure your deployment is successful.

Note: Should you have interest in using S3 Titanium with AWS Auto Scale, please review this post.

Latest S3Rocket Version

April 2021: v1.2.3 :

Webp/Optimized images for Captcha .
Optimized images for admin dashboard.
Auto-sync for WebP/optimized images
–help for CLI

 

Weaponize you Business with aMiSTACX!