S3 Titanium for WordPress Guide & Performance Tips
The S3 Titanium Plugin for WordPress by aMiSTACX is designed to put WordPress into a stateless or semi-stateless configuration. This means all components such as WP Media and Static content are hosted from AWS S3, and the database resides on an AWS RDS instance.
This configuration puts the architecture of WordPress into a true 3-Tier design that will allow true on-demand scaling – vertical and horizontal, and will allow the use of advanced high availability [HA] architecture such as AWS auto scale groups.
Check out our YouTube video showing the S3 Titanium for WordPress.
Note: Our plugin and this stack is designed for individuals with advanced technical ability and understand and have experience with AWS infrastructure and Cloud technology.
Note 2: For best results it is best to make sure you are either building your site from new, or to make sure your theme can handle the S3 deployment. Some themes [that are built correctly] offer seamless integration with our plugin, others require modification.
Note 3: To use with PHP 7.3 requires an update to
/wordpress/wp-content/db.php Please contact support.
Plan Ahead – DNS
Tip 1. – If you selected the option to configure a custom domain for your S3T name resolution, then here are some useful tips: Use a different domain than your root domain! And we do NOT mean a subdomain or the parent domain.
e.g. woo.awsamistacx.com [root] and woo.awsamistacks.com [S3]
Note: This will help quality scores improve as you will not be serving S3 content from a domain that sets cookies.
Fixing: Serve the following static resources from a domain that doesn’t set cookies:
You cannot disable cookies on resources served through CDN Cloudflare. While some speed recommendations will suggest eliminating cookies for static resources, the performance implications are extremely minimal. Cloudflare cookies are also required so security features work properly.
Tip 2. – 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.
Tip 3. – Very Important! Wait about 15-30 minutes for Cloudflare to kick in before you upload any WordPress media content; otherwise, you will get certificate warnings. For example, say WordPress sets a path to a media image that looks like this:
But when Cloudflare CDN has not fully propagated, you will get served a URL that looks like this:
Plus you will get a certificate warnings.
Tip 4. Static Content Deployment to S3
You have the option to deploy static content. If this option is enabled, please disable Apache PageSpeed Module and Redis. This is no need for any local caching engine. Everything will be served through S3 and the CDN will cache everything and serve at the edge.
WP S3 Titanium Configuration
The AWS Keys
Step 1. IAM S3Rocket KEY CREATION
These keys will be used to connect and manage S3 buckets from the S3Rocket Module. Go to the AWS IAM console and create a user with programmatic access and attach the AmazonS3FullAccess policy to the account. Copy both keys and keep them in a safe and secure place.
A. Create user and assign Programmatic Access
B. Select Attach existing policies directly, enter S3 to filter results, select AmazonS3FullAccess
C. Review & Create user
D. Copy and Download a set of the S3 IAM access Keys
Step 2. IAM S3Sonic KEY CREATION
These keys will be used to connect and manage RDS instances from the S3Sonic Module. Go to the IAM console and create a user with programmatic access.
E. Create user and assign Programmatic Access
F. Select Attach existing policies directly, enter RDS to filter results, select AmazonRDSFullAccess
G. Review & Create user.
H. Copy and Download a set of the S3Sonic IAM User access Keys
S3T AWS KEY TAB
After activation of plugin, enter the keys into the appropriate sections to the AWS Key tab. If you are not going to use S3Sonic or S3Rocket, then there is no requirement to enter any keys in that module section. It makes for better security. Use only what you need.
TIP 5. If you have a lot of image files to sync to S3 temporarily use a larger LAMP/LEMP or RDS Database instance. This is because every URL will be re-written in the database.
Note: There are two separate “save” buttons!
Note: If keys are NOT entered, the specific module tabs will be locked.
Step 1. Decide to use an existing bucket or create a new bucket. Make sure if you create a new bucket that the S3 Region matches the region-zone where the EC2 server resides.
After you create or select a bucket, all the tab’s options will show. Most of the common defaults are enabled.
Optional [Static Content Deployment] – This will upload and server CSS/JS content from S3. However, it is best to make sure you are either building your site from new, or to make sure your theme can handle the deployment. Some themes [that are built correctly] offer seamless integration with our plugin, others require modification.
Step 2. If you are using a custom Domain [Recommended] then enable the feature and enter the domain or subdomain. Normally you would want to flag it as a subdomain for tracking purposes. e.g. cdn.example.com or s3rocket.example.com or even s3.example.com, but different than the parent root domain.
As shown with my example domain: tests3t.awsamistack.com
You really do not need to force HTTPS, because you followed the stack instructions and are using “Always HTTPS” on Cloudflare, and/or have Let’s Encrypt Redirecting HTTP to HTTPS. [Better to have Cloudflare handle it at the DNS level.]
It is advised to leave files on server for many reasons, but if you must, feel free to delete on upload.
Object versioning is really required; otherwise, if you update a file, the CDN will serve stale content and you and your devs will go crazy trying to figure out why fresh content is not showing live.
Another advanced option is WebP image compression. Please see our WebP article for more details.
Roll-Back to Local
In the situation where you need to roll-back to having local server in order to serve media files; as of v1.1.3 you now have this option. You must set the first two top switches to off, and the third switch [Reset URLs to Local] to On. Save settings, then use the [SYNC] button.
Important! Please test everything on your Development Server First, and make a full backup of Production before you proceed.
1.1.15 – March 25th, 2019 – Introduced logging in debug mode, pause option for sync. Fixed 504 timeout for AJAX.
S3Sonic will allow the spawning of AWS RDS MySQL read replicas. This may be used on very high volume sites, or sites that require High Availability. Should the main db crash, then the RR will continue read operations, and you can promote it as primary. Again, this is beyond the scope of this simple how-to-do.
Overall an RR will increase throughput and offer high availability. However, make sure you test in development prior to deployment to a production ecommerce site.
When all is configured correctly and working in harmony with our aMiSTACX stack, the feeling of stability and performance is awesome. This is why we call this module series for WordPress and Magento is called S3 Titanium. Don’t just take our word for it.
Better – Stronger – Faster!