1

I have a monolithic e-commerce website in management and like to expand it to multiple servers using a load balancer and single database server.

load balancer    -> server 1  -> db server  
                |             ^
                L-> server 2  |

and in each server there is a web application for e-commerce and these web application source codes are identical.

That identical source codes push me thinking that I might use AWS EFS storage to share same source code in multiple servers so that I only need to manage single source code.

However, I'm not pretty sure that this kind of server structure is good or bad.

Please let me know any better idea or what to consider before implementing this server structure.

Thanks!!

Eric Lee
  • 115
  • 4

1 Answers1

2

Why is source code on your server? Is it PHP or an interpreted language? If it's a compiled language keep your source code off the servers.

Best practice I think would be keep your code in source control, such as AWS CodeCommit, then build / deploy with CodeBuild and CodePipeline. You then have two main options for deployment if you want auto scaling:

  • Have a "gold image" AMI you build after every check-in. When a new instance is required auto-scaling spins it up from the new image
  • Have a system that spins up a new instance based on a plain server image or a customised AMI which downloads the source code, compiles it if required, then puts it into the load balancer. It's not as difficult as it sounds.
Tim
  • 30,383
  • 6
  • 47
  • 77
  • Thanks! I had no idea about the AWS code commit and code build. I will take a look at them to get how it works! – Eric Lee Mar 06 '20 at 07:54
  • AWS has a very wide range of services, including odd ones like satellite ground stations, AI racing cars, and a wide variety of tools that help you deploy infrastructure and applications. 130+ first class services from memory :) – Tim Mar 06 '20 at 08:05
  • That’s awesome! I only used ec2 and s3 before and look for a third party application for extra services. But when i just looked at Aws service list, it has tons of services i needed before! Thank you for letting me know – Eric Lee Mar 06 '20 at 08:13