AutoScale Website with AWS EC2 and AWS RDS.

I wrote recently about testing AWS auto scaling policies. Before you can test auto scaling policies however, you need an auto scaling configuration to test! This post will look at building a simple auto scaling configuration, to provide a scale-able and highly available web site.  Before starting on the configuration, there are a bunch of services that need to be in place for the auto scaling group to function. These include:

  • A VPC to launch our instances into
  • A ELB to attach our auto-scaled instances to
  • An AMI to launch. Either a custom AMI or one provided by Amazon, depending on the use case
  • CloudWatch – used to monitor the performance of the AS group, and to trigger auto-scaling activities

The autoscaling configuration itself is composed of two parts. Firstly there is the launch configuration, which is the config template that the Auto Scaling group will use to launch instances. Then there is the Auto Scaling group itself, which defines how many instances you want to run and how the group will scale under certain conditions:

  • Prepare your Linux OS.
  • Configure Git.

   yum install git
   git config
   git config --list
   git config --list --show-origin
   git config --global “test"
   git config --global “test"
   git config --global [email protected]
   git config --list

  • Create an RDS auto scale
    • RDS with autoscale is done via AWS console and is a very straightforward configuration, which I will not cover here.
  • Export data and import to RDS in one command.

mysqldump -u cakephp --databases cakephp -p'sdfdfds23' --single-transaction --order-by-primary | mysql -u admin --port=3306 -padmin1234

  • Once the AutoScaling Group is created. You can test it with stress command which should have installed with userdata in the Instance template. If not you can install it manually.

yum install stress -y

[[email protected]]# stress --cpu 1 --timeout 300
stress: info: [2919] dispatching hogs: 1 cpu, 0 io, 0 vm, 0 hdd

Please reach out to us at twitter  @LaniakeaG or whatsApp us @+16284008047