简体   繁体   中英

Starting an auto-scaling solution from a single ec2 instance

Continuing Is it "okay" to host a small wordpress blog on one AWS EC2 Instance without load balancers/beanstalk?

Thank you very very much for this. One follow up. If I use two instances and a load balancer, how do I get what is currently my one instance wordpress blog working properly between them? I understand I create an AMI, but then do I have to update it every time I post on wordpress?

What is a basic, correct way to start implementing an auto-scaling solution from a single EC2 instance?

There are 2 aspects to be looked into.

  • Wordpress Database
  • Wordpress Files (Application Files including plugins,themes etc.)

Where to keep the Database?

  • For enabling auto scaling setup and to ensure consistency, you will need to have the database outside the autoscaling EC2 instance.

  • If the database is in RDS, then well and good.

  • Else, if its within your EC2 instance, then I would suggest to have 1 EC2 instance outside auto scaling setup and keep the database inside that.

How to setup EC2 Auto Scaling?

  • Step 1: First create a duplicate Wordpress Instance from the existing one (Using AMI). This will result in 2 EC2 instances. Instance 1 (the original one with Database) and Instance 2 (The copy of Instance 1)

  • Step 2: In instance 2, configure your Wordpress to point to the database inside instance 1

  • Step 3: Take AMI of Instance 2 (This will be used as base AMI for autoscaling group)

  • Step 4: Using the AMI created in Step 3, create and configure Autoscaling

These steps will ensure that all the autoscaling instances will point to the same database and hence you dont have to update autoscaling every time you create/update the contents.

However, whenever you change the designs/plugins/other contents which creates/updates the application or the files of wordpress installation, you will need to update the Autoscaling group.

If you want to get rid of this one as well, consider using EFS to have a shared volume across all EC2 instances and configure the wordpress installation to work from that EFS volume. This along with above steps will make the installation completely autoscalable without worrying about updating the autoscaling setup at all.

You can setup the entire environment by using Elastic Beanstalk with EC2, ELB, RDS and auto scaling group configured in it.

Below link can help you to setup word-press using bean stalk

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-hawordpress-tutorial.html

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM