Laureline's Wiki

Lab 02: App Scaling on Amazon Web Services

This is an old revision of the document!


Lab 02: App Scaling on Amazon Web Services

PEDAGOGICAL OBJECTIVES

  • Deplay a web application in a two-tier architecture for scalability
  • Use virtual machine images to clone a web application onto additional virtual machine instances
  • Use a load balancer that is provided as cloud service
  • Performance-test a load-balanced web application

TASKS

In this lab you will perform a number of tasks and document your progress in a lab report. Each task specifies one or more deliverables to be produced. Collect all the deliverables in your lab report. Give the lab report a structure that mimics the structure of this document.

You should have from the previous lab a micro instance running Ubuntu Server 14.04 LTS with Drupal7 installed. In the following we will refer to it as the Drupal master instance.

You will improve the Drupal site to make it scalable. Your site will be able to absorb traffic increases by adding virtual machines that process requests in parallel. Following a two-tier architecture the business logic and presentation layer will be separated from the database layer so that the former can be replicated in multiple virtual machines. The database moves into Amazon's Relational Database Service (RDS) which provides automatic backup, data replication and failover.

Note: Not all deliverables get you the same number of points. Deliverables that only verify that you performed some instructions get fewer points, deliverables that ask questions that test your understanding and require thinking get more points.

Task 1: Create a database using RDS

Endpoint Address: david-drupal.ciuq8ad2qsbu.eu-central-1.rds.amazonaws.com

RDS Cost Comparison

With the RDS service: 15.33 $ per month With the EC2 instance: 10.85 $ per month

We can see that it is cheaper to run an EC2 instance than the RDS service. This difference exists because with the RDS service the customer has no need to performe maintenance on its database. Everything is managed by the Amazon team. The customer just have to instantiate it and use it. On the other hand, if the customer choose to use an EC2 instance to exploits its database, he will have to manage it himself.

Why use RDS service ?

By using the RDS service, the IT team of the company won't have to manage the database. All the maintenance will be done by the Amazon team which will spare some work for the company's IT team.

Why use EC2 instance ?

By using an EC2 instance, the IT team will have the full control on the whole database's componants. This could be interesting if the IT team has to create a specific environnement to manage its database. Howewer, the team will have to manage its instance and performe all the maintenance tasks by themselves.

Task 2: Configure the Drupal master instance to use the RDS database

$dbs['mysql'] = array(
  'driver' => 'mysql',
  'database' => 'drupal7',
  'username' => 'drupal7',
  'password' => 'SXFYnsGQXmsr',
  'host' => 'david-drupal.ciuq8ad2qsbu.eu-central-1.rds.amazonaws.com',
  'port' => '3306',
  'prefix' => ''
);
 
// Other driver config ...
 
$databases['default']['default'] = $dbs['mysql'];

Task 3: Create a custom virtual machine image

Task 4: Create a Load Balancer

Load Balancer DNS: David-Drupal-2050734920.eu-central-1.elb.amazonaws.com

Load Balancer IPs: 52.29.19.144, 35.157.175.254

172.31.24.195 - - [06/Mar/2017:13:28:45 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"
172.31.14.9 - - [06/Mar/2017:13:28:45 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"
172.31.24.195 - - [06/Mar/2017:13:28:55 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"
172.31.14.9 - - [06/Mar/2017:13:28:55 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"
172.31.24.195 - - [06/Mar/2017:13:29:05 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"
172.31.14.9 - - [06/Mar/2017:13:29:05 +0000] "GET /index.html HTTP/1.1" 200 11632 "-" "ELB-HealthChecker/1.0"

Task 5: Launch a second instance from the custom image

System components diagram

System's monthly cost

Task 6: Test the distributed application