This document discusses using Amazon S3 and EC2 services in Ruby on Rails applications. It describes how S3 provides redundant data storage and EC2 offers on-demand virtual servers. Various tools are presented for backing up to S3, hosting assets on S3, and using EC2 for extra computing capacity and load balancing. Load balancers like Swiftiply are also covered for distributing requests across backend servers.
10. Am azo n We b Se rvice s
Simple Storage Service - S3 Elastic Compute Cloud - EC2 E-Commerce S..
Redundant Data Store Virtual server per hour …….
$0,15 per GB data per month $0,10 per CPU hour
$0,10 - $0,20 per GB traffic $0,10 - $0,20 per GB traffic
10
11. S3 - Sim ple Sto rage Se rvice
• Redundant storage - as much as you like
• max. 5 GB per object
• Organized in „Buckets“
• Web Service API for uploads
• Downloads via
• Web Service
• HTTP / HTTPS
• BitTorrent
11
12. S3 - Bucke ts
S3
• Unique over all S3
• Contains many
MyBucket_name www.peritor.com
key-value-metadata tupel
foto_5.jpg site/screen.css
• Cannot contain other buckets!
backups/januar.zip site/script.js
• Key can contain „/“ fotos/2007/001.png FreeBSD-6.2.iso
12
14. EC2 - Elastic Co m pute Clo ud
• Based on XEN virtualization
• On demand virtual servers - controlled with Web Service API
• 1,7 GHz
• 1,75 GB RAM
• 160 GB local file system (not persistent!)
• Use your favorite Linux distro (Linux 2.6.16),
Amazon Machine Images (AMI) are stored on S3
• ACLs for hosts/ports access control
14
15. EC2 To o ls
List availabe images
Start a new instance
Login with SSH
Shutdown instance
15
30. Lo ad Balance r / Pro xy
Example mod_proxy_blancer:
• Talks to multiple backend servers
(Mongrel)
• Central Proxy/Load-Balancer
configuration that has knowledge about
nodes
• Typically proxy restart on config change
30
31. Sw iftiply
Swiftiply Proxy:
• Multiple backend clients have a
persistent connection to the backend
port
• Proxy listens on cluster port for requests
and forwards them
No re-configuration
31