I don't have any experience with Xenforo so I'm guessing a bit in regards to how it will interact with some of the other resources.
For an AWS setup you would want to get each part split out and scaled independently. Using either auto scaling groups where you manage the VMs yourself or with the managed services offered by AWS.
An auto scaling group is a collection of resources where you specify the type of ec2 instance (vm), the AMI, and how many of them you want.
- These can be scaled based on utilization
- e.g 75% cpu utilization for more than 5 minutes then +1 instance
- These can be tricky to tune when you factor in how long it takes to for a new resoure to come available
- A schedule based on the number of instance you want
- e.g. Starting at 1am you want a minimum of 2 instance with a maximum of 3
- e.g. Starting at 9am you want a minimum of 4 instance with a maximum of 5
That auto scaling group is associated a launch configuration which will configure the instance to your desired state.
- When an auto scaling group creates a new instance it will run this
- It can be a simple shell script/yum install X/Y/Z
- A chef cookbook or puppet module to handle more complex configuration
- At this point we can interact with our other AWS resources, which is how we can automate some things. For example when creating a web server you don't point the reverse proxy at an IP you point at the DNS addresse produced for the app server elb which amazon will populate once that resource is created.
All of this stuff is pretty easy to automate, and as far as a high level setup it would be something like:
- Create an auto scaling group of NGINX servers.
- What does NGINX do in this setup? Is it mostly a reverse proxy over to Xenforo and serving some static assets?
- The launch config for these would configure the reverse proxy to point at the point at the ELB for the Xenforo servers
- Create an ELB that points to the auto scaling group of the Xenforo servers. This will produce a DNS A record so the web server cluster has a consistent place to direct all traffic to
- Create an auto scaling group of Xenforo servers
- This will be the tricky part to get configured, as other have mentioned. Both from how the software works like how does it handle sessions when a person is bouncing between servers (this is probably where memcache comes in?) or would there need to be some sort of session stickiness. Also can the install be totally automated (even down to db connection strings) or are any manual steps needed?
- The resources Xenforo needs you have more options as this is where the AWS managed services are available to you. I'm guessing most of this stuff is configured in Xenforo in some sort of admin screen where you put connection strings and password? Depending on how Xenforo uses these systems will probably determine the uses cases here.
- For MySQL you can use the AWS RDS service (Amazon Relational Database Service (RDS) – AWS). RDS handles backups automatically and it has a number of high availability/fail over options.
- Alternatively you can maintain the DB instance/cluster yourself with either an autoscaling group (which means your launch configuration will have to be aware of the other instances and join the cluster properly) or you just make a single instance and make good/frequent backups.
- For memcache amazon offers the service ElasticCache (which can either be memcache or redis backed). Or again we could have some sort of auto scaling group.
- Elasticsearch same deal. There is an AWS managed service. The trick here might be in authorization. The AWS version requires requests be signed with the proper credential so the Xenforo servers talking to it would probably need some sort of plugin to sign the requests or the Elasticsearch service would have to allow unrestricted access to everything in the VPC (it would not be reachable from the internet).
- Again the alternative is a auto scaling group of elasticsearch servers. I believe the best practice for elasticsearch is to scale based on a master/replica/controller setup but at the scale here it is probably easier to just have a cluster of servers that all do everything.
- For the attachment/cloudfront stuff. That would require some sort of Xenforo plugin/setting I am guessing. If Xenforo can be configured to upload to S3 then it is easy to have it push the attachments there and put a distribution in front of it.
Having the web servers in additional regions is easy enough to do. Though I would see how the performance is in a single region before going down that road. I'd also need to understand the interactions between Xenforo and the various datasources better. If it is really chatty with MySQL it will is going to add a lot of overhead with all those round trips/a read replica of some sort may be required. But if it caches most of the data in memcache/elasticsearch it may be enough to have those in both regions.
What I laid out about is assuming just using EC2 instances/VMs. It is possible to do approximately that with containers using EC2 Container Service (
Amazon ECS - run containerized applications in production) though there is an additional layer of configuration there. In that case you just make one auto scaling group for ECS and then ECS handles maintaining the running tasks. You configure application load balancers to route the traffic between your tasks. There are similar scaling options but I am less familiar with them.