How do I get EC2 load balancing properly set up to allow for real time file syncing?

前端 未结 4 1604
礼貌的吻别
礼貌的吻别 2020-12-30 15:33

I\'m new to EC2. I have read a lot about it, watched many videos and tutorial and pretty much familiar with how everything work. I still have few question that I can\'t seem

4条回答
  •  独厮守ぢ
    2020-12-30 16:05

    If anyone is reading this in 2019 I thought it would be good to chime in.

    To completely leverage horizontal scaling you have to keep your EC2 instances stateless. More details can be found in this aws whitepaper under Stateless Architecture.

    https://d1.awsstatic.com/whitepapers/AWS_Cloud_Best_Practices.pdf

    Do I need to have the database on RDS where every instance simply points to it.

    Yes! this is a pretty standard aws setup.

    How about user files. If a user uploaded a file to the site, then this file should be available immediately on all instances immediately, how is this possible. I don't think having 3 copies on 3 instances is very practical.

    This is part of the magic that comes with AWS and the cloud. This is can be done with S3. S3 implements something call read-after-write consistency which guarantees full consistency for all new put requests.

    If I modify the site, let's say change the something in the CSS file, how do I sync the changes to all instances.

    This depends on how your deployment process is like. For static content you can consider using CloudFront. This has versioning for static files. Another way to do this would be to use an autoscaling group. Swap out the launch config with a new ami containing the new version and start terminating the old instances one by one!

    How do EBS or S3 play a role in all of this. EBS and S3 serve very different storage needs. This question is too broad to answer.

    My two cents would be to read up on aws best practice and architecture to fully leverage the cloud. Dont try to reinvent the wheel. Things are actually simpler than they seem. Cheers. Why isit so hard to sync files across ec2 instance? maybe because you dont have to do it to begin with (yes there are in some cases where this is necessary however i dont think this is one of them). Question the question. Ask if there a way of building this out where I dont have to sync my files with git? Build cloud native architecture and programs to fully leverage the cloud and make your life easy.

    However, if you still want to go down this road for whatever reason i would look into devops on aws to manage the resources. Cheers!

提交回复
热议问题