Prev | Current Page 355 | Next

Brad Ediger

"Advanced Rails"


DELETE object
Deletes the object at the given location. By analogy to Unix file permissions,
you must have WRITE access on a bucket to delete objects within it. Deleting
a nonexistent object is not an error, but is effectively a no-op.
S3 Clients and Servers
Marcel Molina, Jr.??™s AWS::S3 library (http://amazon.rubyforge.org/) is the most
popular client for S3. Its design was inspired by ActiveRecord, and it is simple and
elegant:
require 'aws/s3' # gem install aws-s3
AWS::S3::Base.establish_connection!(
:access_key_id => 'MyAWSAccessKeyId',
:secret_access_key => 'MyAWSSecretAccessKey'
)
image_bucket = Bucket.create "images.example.com"
S3Object.store(
'hello.jpg', # key
File.read('hello.jpg'), # value
'images.example.com', # bucket name
:content_type => 'image/jpeg',
:access => :public_read
)
Further Reading | 235
The s3fuse project (http://sourceforge.net/projects/s3fuse/) is an implementation of an
S3 client using FUSE (a Linux filesystem framework that runs in userspace rather than
kernel space). This makes it possible to mount an S3 bucket as a Linux filesystem and
use it transparently within unmodified applications.
Park Place, by why the lucky stiff (http://code.whytheluckystiff.net/parkplace), is a
nearly complete clone of the Amazon S3 web service. It is perfect for developing and
testing S3 applications without requiring an S3 account or payment.


Pages:
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367