AmazonS3 & Rails

5,719 views
5,618 views

Published on

A quick overview of AmazonS3 and how you can use it with rails

Published in: Business, Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,719
On SlideShare
0
From Embeds
0
Number of Embeds
30
Actions
Shares
0
Downloads
90
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

AmazonS3 & Rails

  1. 1. AmazonS3 mstannard@gmail.com
  2. 2. What is it? S3 = Simple Storage System quot;Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers.quot;
  3. 3. Features Write, read, delete from 1B to 5GB REST and SOAP interfaces HTTP & BitTorrent protocols supported Authentication built-in US & European storage
  4. 4. Why use it? CDN Fast Scalable Simple Inexpensive Reliable 99.99%
  5. 5. Basic Concepts Object - data + metadata (custom + some standard) Bucket - the storage container (max 100 / dev) - must be unique across whole S3 service Key - unique identifier of an object in a bucket
  6. 6. Using S3 with Rails Signup at Amazon Install AWS::S3 gem Install attachment_fu plugin
  7. 7. config/amazons3.yml development: bucket_name: reading_eggs_development access_key_id: my_access_key secret_access_key: my_secret_key test: bucket_name: reading_eggs_test access_key_id: my_access_key secret_access_key: my_secret_key prod: etc.....
  8. 8. attachment_fu before: has_attachment :content_type => 'application/x-shockwave-flash', :storage => :file_system, :path_prefix => 'path/to/files/', :max_size => 10.megabytes
  9. 9. attachment_fu after: has_attachment :content_type => 'application/x-shockwave-flash', :storage => :s3, :max_size => 10.megabytes
  10. 10. attachment_fu access: >> p = PartFile.find(:first) => #<PartFile:0x23a0eb0 @attributes={quot;content_typequot;=>quot;application/x-shockwave-flashquot;, quot;sizequot;=>quot;4434939quot;, quot;idquot;=>quot;315quot;, quot;filenamequot;=>quot;I_and_a.swfquot;} >> p.public_filename => quot;http://s3.amazonaws.com/reading_eggs_dev/part_files/315/ I_and_a.swfquot; >> p.full_filename => quot;part_files/315/I_and_a.swfquot; >> p.bucket_name => quot;reading_eggs_devquot;
  11. 11. Pricing Storage $0.15 per GB-Month of storage used Data Transfer $0.10 per GB - all data transfer in $0.18 per GB - first 10 TB / month data transfer out $0.16 per GB - next 40 TB / month data transfer out $0.13 per GB - data transfer out / month over 50 TB Requests $0.01 per 1,000 PUT or LIST requests $0.01 per 10,000 GET and all other requests* * No charge for delete requests
  12. 12. Sample Costings Data Storage Costs 1GB/M $0.15 1 GB Storage = $0.15 Bandwidth Costs 5000 Users 200 MB / User / Month 0.2 GB * 5000 = 1000GB * $0.18 = $180 Request Costs Request = 200/User/Month = 5000 * 200 = 1M get requests 1000000/10000 = 100 * $0.01 = $1 Total Cost US$181.15
  13. 13. Resources Amazon S3 : http://aws.amazon.com/s3 AWS::S3 gem : http://amazon.rubyforge.org/ s3fox : http://www.rjonna.com/ext/s3fox.php s3 calc : http://calculator.s3.amazonaws.com

×