We have a bunch of websites (>15) running on the same codebase. Currently our strategy is to run every website on a separate Lightsail/EC2 instance. Website behavior depends on .env file but it is possible to change this dependency to hostname. We have a lot of git changes every day. We keep instances state in sync via Deployer (Gitlab CI/CD). Due to our strategy (one website - one VPS) it is costly to scale such infrastructure.

There is a single master instance for admin & content editing purposes with write access to RDS database. Other instances are used for website domains and they have read access to RDS DB I mentioned before. We also have S3 for product gallery.

It seems it would be pretty standard to migrate such infrastructure to AWS ASG but there are some bottlenecks:

  • every website has local MySQL DB (storing orders, cart, user uploaded images, queue, etc.)
  • every website has several supervisor workers
  • every website has own local files (such as logs, user uploaded images)
  • every website has own Redis Storage

How could we move this infrastructure to AWS ASG/ALB to reduce costs?

I've checked Where to start? Scaling PHP applications on AWS answer but I couldn't figure out how to handle these bottlenecks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.