Friday 14 June 2013

Reference Architecture - Auto-scaling Moodle deployment on AWS

AWS provides a highly scalable and reliable cloud hosting environment for Moodle. With features like Auto Scaling Groups, Elastic Load Balancers and CloudWatch Monitoring services, Moodle deployments on AWS can be configured to automatically scale up and down seamlessly to meet the highs and lows in the demand curve in the most optimum and cost-effective manner. This post presents reference architecture for deploying Moodle Learning Management System over AWS Cloud to achieve high levels of Performance, Scalability, Availability, Security and Reliability.


Architecture Components

Moodle Web Tier
Moodle Web Tier is composed of multiple EC2 instances that act as Web Servers running Linux OS with Apache and PHP. The EC2 instances are bootstrapped using a pre-configured Amazon Machine Image containing necessary software stack along with Moodle Software.

These EC2 instances are launched automatically by Auto Scaling Groups based on an auto-scaling policy that utilizes data from CloudWatch Monitoring Services. CloudWatch monitoring services are configured to generate alerts when they see changes in the demand curve. Auto Scaling Groups subscribe to these alerts and increases / decreases EC2 instances to meet the demand curve. Auto-scaling groups are placed in different Availability Zones to provide high-availability. Even if a failure occurs in one availability zone, user’s would not experience any problems as they will automatically be served from the other availability zone.

HTTP Session state is maintained in Dynamo DB which is a highly available and scalable No-SQL database. This approach enables the Web Servers to be completely stateless and users can be served from any Web Server, which results in effective distribution of traffic.

Moodle Content Repository
Static content and resources including video, audio, images and multimedia objects embedded inside Moodle courses are stored in Amazon S3 Storage Service (registered as a repository in Moodle). Amazon S3 is a highly durable and scalable storage infrastructure that is highly available. Objects stored in Amazon S3 are delivered via Amazon CloudFront that automatically edge-caches these objects and routes requests to the nearest edge-location for speedier delivery.

MoodleData Folder is stored on S3FS mounted drives on Web Servers (EC2 Instances) backed by centralized storage in Amazon S3. Instead of S3FS mounted drives, you also have the option to setup a NAS (Network Attached Storage) Server using EC2 instance with attached EBS volumes in AWS.

Moodle Database Tier
Amazon RDS MySQL service is being used to host Moodle database. Amazon RDS is a managed Relational Database Service that automatically patches the database software and backs up database and support point-in-time recovery. It provides the flexibility to scale the compute resources or storage capacity associated with the Moodle database to achieve high levels of performance. RDS Multi-AZ deployment enables to maintain a stand-by replica of master Moodle database in another availability zone to fall back in case of any failures in the master database. RDS Service automatically syncs the standby copy with the master database.

Application Services
AWS provides a host of services that can be utilized in Moodle Deployment included Simple Email Service for sending emails, SNS for generating notifications, SQS for integrating Moodle with other applications via queues. Moodle also supports multiple authentication options including LDAP Integration that can be configured on AWS.