• Cloud hosting provider • Various services • We’ll be using Elastic Load Balancers, EC2 (Elastic Compute Cloud) and RDS (Relational Database Service) What is AWS? Web Consultancy
Auto-scaling Web Consultancy • Create new web servers • Use ELB load balancer • Use Amazon RDS database which will in this example will need to be large enough to handle our traffic peaks
• Configuration management tool • Install packages • Ensure services like Apache are running • Write out configuration files from templates • Restart services when templates change What is Chef? Web Consultancy
Web Consultancy Collections of recipes, templates and other configuration attributes to get stuff done. Chunks of Ruby code that describe what stuff we need to do to get that stuff done. Cookbooks Recipes
Web Consultancy A virtual machine, cloud server or dedicate server Resource Creates a user, expands a template, installs a package, starts a service etc Node
Web Consultancy package "ntp" do action :install end ! template "/etc/ntp.conf" do source "ntp.conf.erb" owner "root" group "root" mode 0644 notifies :restart, resources(:service => "ntp") end ! service "ntp" do action :start end Install package Create config file from template Define service and start NTP Restart service when config file changes
Web Consultancy web_app node['phpapp']['host'] do template "phpapp.conf.erb" docroot node['phpapp']['dir'] server_name node['phpapp']['host'] end Our recipe
Auto-scaling Web Consultancy https://github.com/hellofuture-cookbooks/hf-lamp hf-lamp • Different recipes for installing dependencies and setting up you application configuration
Auto-scaling Web Consultancy • chef-solo to create an instance with dependencies installed • Create an AMI image from that instance • Use that instance in you auto-scaling launch configuration
When to auto-scale Web Consultancy ! • Create CloudWatch alarms on key metrics such as CPU load • Scale up when a high percentage of total of the metric is being used • Scale down when low percentage of the metric is being used