• Photo website.
• Photos are uploaded by the public.
• Photos are converted asynchronously by
separate processing servers
• Very simple app, but hopefully shows some
ideas of how cloud computing apps work.
• Seriously, it’s a demonstration app.
How is it built?
• Web application running on Ec2
• Database is Amazon SimpleDB
• Storage is Amazon S3
• CDN is Amazon Cloudfront
• Messaging queue is Amazon SQS
• ~200 lines of code
• Simple. Right now, they are the market
leader... But the competition is good.
• Tight integration between services
• Lots of documentation and libraries
• Servers “on demand”.
• Pay by the hour: $0.10 - $0.80/hour
• Non persistent.
• Forces you to automate your conﬁguration.
• RightScale helps a lot with this.
• Elastic IP can give you a static IP
• Elastic Block Store gives you persistent data
• Oldest of the publicly available web
• Scalable, reliable data storage mechanism
• Bucket/object concept
• Pay for the data you are storing, as well as
bandwidth in and out
• $0.15/GB stored. $0.10/GB transferred.
• Similar to LimeLight, Akamai
• Low latency, high data rate
• 8 edge locations in the US
• Origin server is an S3 bucket • Ashburn, VA
• 24 hour object expiration
• Dallas/Fort Worth, TX
• Los Angeles, CA
• Miami, FL
• Very simple API • Newark, NJ
• Palo Alto, CA
• Seattle, WA
• St. Louis, MO
• Simple (but powerful) database
• Non-relational. No tables, only “domains”
• No schema. Deﬁne it as you go
• All data is stored as strings
• Attributes can have up to 256 values
• Automatically indexes all your data
• Database is typically the ﬁrst major
bottleneck of a web application
ACID and BASE
• Big trend away from traditional RDBMS
• They carry lots of baggage, and do not scale
horizontally very well
• ACID (Atomicity, Consistency,
• BASE (Basically Available, Soft State,
• Given: Consistency, Availability, Partition
tolerance. Choose two.
• ACID = CA
• BASE = AP
• SimpleDB (written in Erlang)
• Google BigTable
• CouchDB (written in Erlang. Queries are
written in JS)
• Berkeley DB
What does this mean?
• I don’t worry about scaling
• Database performance is very consistent
• S3/Cloudfront handles static ﬁle serving
• Minimal upfront investment
• Only pay for what I need
• Very quick time to market
Step 1: Upload
redirect on (ec2 instance)
Step 2: Create SQS jobs
jobs = [
#ConvertJob.new(key, quot;thumbnailquot;, quot;100x100quot;),
#ConvertJob.new(key, quot;mediumquot;, quot;200quot;),
ConvertJob.new(key, quot;originalquot;, quot;400quot;),
ConvertJob.new(key, quot;paintquot;, quot;400quot;, quot;-paint 5quot;),
ConvertJob.new(key, quot;monochromequot;, quot;400quot;, quot;-monochromequot;)
# Put the jobs into the SQS queue
sqs = RightAws::SqsGen2.new
convert_queue = sqs.queue(quot;convertquot;)
jobs.each do |job|