Home > database >  2 AWS Lightsail instances what happens when one gets changed
2 AWS Lightsail instances what happens when one gets changed

Time:09-29

lets say you have a big Website so you need to add a additional instance of a AWS Lightsail server. So you do a Snapshot and create a new Instance. The instance hosts Plesk on Ubuntu and has a database and a WordPress site.

Now somebody registers on the website and the created user gets added to the database. Does the user now also get added to the additional instance? If not how can you add the functionality that when a edit happens on one instance the other Instance also overtakes the changes.

I'm just getting started with AWS and would like to find out.

CodePudding user response:

If a user registers on Server 1, it would not reflect on Server 2. Similarly, any posts made on the first site would not show up on the second site. This is because the disk (which holds both the database and any files necessary for posts) is not shared between the two instances, so any changes made to one disk are only reflected on that one server.

Honestly, for hosting Wordpress, your best bet is probably to use a dedicated Wordpress host so you don't need to worry about scaling.

However, you can do what you're looking to do in AWS as well. You essentially need a shared database, which you can do either with a third instances or by using Amazon's RDS service. If you have enough load that you need more than one server, I'd highly suggest using AWS's RDS service instead of trying to build your own database service. Once you have a shared database, posts and users registered in one server will show up on the other. You'll also likely want a load balancer to balance requests between the two servers (there is a service called "Lightsail Load Balancer" that's meant for this).

If you're dealing with a significant request load, you should take a look at AWS's reference architecture for WordPress: https://docs.aws.amazon.com/whitepapers/latest/best-practices-wordpress/reference-architecture.html

Happy Reading!

  • Related