Showing results for 
Search instead for 
Did you mean: 

Cluster Hosting on AWS - Magento 2.2 CE

Cluster Hosting on AWS - Magento 2.2 CE

Hi Everyone,


I'm looking to get some advise around best practises when configuring a Clustered Hosting Environment on AWS for Magento 2. So far, from reading web forums and watching a few presentations / videos, I've gathered the following information:


- Separate the "Admin" host from the front end servers. Each in their own Autoscaling Group, behind a load balancer. Run the Cron jobs on the Admin host. Use a custom URL to direct admin traffic to the admin host.

- Use AWS RDS for the DB - either MySQL natively, or Aurora.

- Use Elasticache for the three cache's (Backend, Session and Full Page).

- Consider using a CDN - Cloudfront or Cloudflare etc.

- Consider using a separate Varnish server in it's own Autoscaling Group, behind a load balancer, pointing towards the Front End / Application Servers Load Balancer.


All of this makes good sense. But, it leads me to a few questions....:


- What's recommended for Shared Storage? I've seen some people placing their pub/media folders on AWS EFS. I've also seen some people putting their app/etc, var/report, var/log and var/backup folders on EFS too. Any advise either way?

- What's the preferred way to place the whole cluster into Maintenance mode? Is it best to share the whole var folder, or does this slow things down too much?

- I'm trying to automate the deployments from CodeDeploy via a GitHub hook. This works fine for a single host, but I'm not sure of the best way to do this for a whole cluster. I appreciate only the "Admin" host should be running the setup:upgrade command - but if there any resources around the order of the upgrades that's worth looking into?


Appreciate I'm asking quite a lot in this post - hopefully it'll be useful for other folks down the road too.






Re: Cluster Hosting on AWS - Magento 2.2 CE

information you have is correct.

you can either create instance with shared drive, or create shared filesystem.

when instance starts it will use configured shared drive or re-sync shared filesystem.

MagenX - Magento and Server optimization

Re: Cluster Hosting on AWS - Magento 2.2 CE

I STRONGLY advice to share on NFS/EFS only the files that are absolutely required to be always synced between all the web nodes: /pub/static and pub/media.

Don't share the "app" directory since it will give you a lot of performance problem, even with php's opcache enabled.

For every upgrade you will need to use a script to rsync all the directories (expect pub/static and pub/media) between the web nodes, this could be tricky but you will gain on the performance side.