Watch our video
October 2021
4 min. read

How to make your Magento applications scalable using AWS

Handling traffic spikes, and keeping an eCommerce website up and running fast during marketing campaigns has always been challenging, particularly when it comes to a platform like Magento.

Magento 2 is also more resource-consuming than the first version and requires more mandatory services to run out of the box.

But before we jump into the examples, let’s define what we mean by application scalability and application Based on our previous article Building scalable and resilient applications using AWS, we will see today how AWS scalability and resilience capabilities can apply and be used in a Magento 2 application.

Magento 2 requirements

Before explaining how to scale your Magento 2 website on AWS, we need to have a look at what Magento needs to run correctly. Here’s a summary of basic requirements: 


Scaling compute

AWS Auto Scaling allows you to automatically scale your compute (EC2) instances according to load conditions you define—such as CPU utilization or RAM consumption—also known as Dynamic Scaling. 

It reduces the need to manually provision EC2 capacity in advance and when it is already too late, and directly follows the demand curve to start & stop additional instances on the fly.

You could also rely on Predictive Scaling, which aims to predict future traffic based on daily and weekly trends, thanks to machine learning algorithms. This helps provision against the right number of EC2 instances when they are needed.

Scaling fast and efficiently

In order to respond to the fluctuating eCommerce demand—reactively or proactively—it is crucial to scale up and down as fast as possible. 

When working on AWS, in order to do so, you could consider building a custom Amazon Machine Image (AMI) to pre-install and compile all needed packages, services and tools, and save time later on during booting and provisioning.

On top of new instance(s) availability, you should also consider Magento 2 deployment steps, which could slow down the availability of those new instances.

Cloning the code, running the composer install command, deploying static resources, etc., could take several minutes to execute. This makes your auto-scaling mechanism slow and inefficient to properly handle instant spikes and hurts resiliency. 

We recently wrote about a Magento 2 build & deploy commands workflow, used in a Docker context, which covers that part and might help you to address this. Most of the application deployment steps are done at the build stage, from which a Docker image—containing the entire and compiled application codebase—is created, and will be reused later on. Thanks to that encapsulation done in advance, It will be a matter of seconds to make your application available on new instances, enhancing the overall resiliency of your infrastructure.

Scaling RDS databases

Magento always suffered from its database heaviness. Still relying on the legacy EAV data model, it also became bigger and potentially heavier after more and more features and integrations were added over time.

Reaching traffic spikes, in addition to sudden connectivity increases, can result in complex parallel SQL queries execution, increasing the database workload, and slowing down your website completely. AWS RDS allows you to create, maintain, and scale relational databases in the cloud, to answer this kind of situation.

Firstly, by deploying your production instances in multiple availability zones, you get a physically distinct and replicated version of the database on each AZ. When an infrastructure failure occurs, Amazon RDS performs an automatic failover to any standby or replica instance, from another AZ. This allows you to resume database operations, as soon as the failover will be completed, without the need for manual intervention. 

When it comes to scale resources and absorb any workload, AWS Aurora is probably the most appropriate choice. Compared to an RDS MySQL master instance—which needs to trigger a downtime in order to scale vertically, even in multi-AZ configuration—Aurora Auto Scaling feature allows your Aurora DB cluster to handle sudden increases in connectivity and workload, by providing up to 15 read replicas you can define through a scaling policy, without any downtime or outage.

Aurora Auto Scaling adjusts the number of Aurora Replicas up or down in response to actual workloads, determined by using Amazon CloudWatch metrics and target values.

As a cloud-native database, compared to RDS MySQL, AWS Aurora addresses better matters of availability and resiliency and is an excellent choice. Aurora is being fully supported since the release of the 2.4.3 Magento version.

Scaling tiers

AWS ElastiCache, OpenSearch, and MQ services are most convenient and easier to scale, as none of them requires any downtime after vertically or horizontally scaling actions. When you have to do it manually for OpenSearch and MQ, you can opt-in for ElastiCache for Redis that has recently been integrated with AWS Auto Scaling, eliminating the need for any manual administrative intervention to scale.

Using AWS to make your Magento application scalable is a great strategy. The number of services and features you have at your disposal is huge!

If you’re looking to leverage the scalable and resilient capabilities of AWS to build other types of applications, make sure to check out the previous article on how to build scalable and resilient applications with AWS

I hope you found this article helpful! Book a demo with us If you’re interested in seeing how Artifakt is using AWS to provide you with the most seamless experience possible.

Also on our blog

Comment CWS et Artifakt ont réalisé un Sylius headless pour un ambitieux client européen ?
Artifakt a accompagné l’agence web CWS pour l’hébergement de Pelta Défense, une nouvelle marque sur un marché de niche à fort potentiel : les produits d’auto-défense.
Svetlana Pogodina
29 September
3 min. read
[🇫🇷 FR] Qu’est-ce que le PaaS ? Avantages, désavantages, et coûts
Dans cet article, nous parlerons de ce qu'est le PaaS, ses avantages et ses inconvénients, ses coûts, et surtout comment cela peut aider votre organisation à créer de meilleures applications.
Djalal Elbe
24 August
6 min. read
[🇫🇷 FR] Top 10 des avantages du PaaS pour une agence web
Maxime, Product Manager chez Artifakt fait son retour d'expérience en tant qu'ancien chef de projet en agence web et explique comment utiliser un PaaS aurait pu améliorer son travail au quotidien. 
Maxime Herbaut
21 July
7 min. read
Stay up to date and join the mailing list to get the newest articles!