S3 Says "Hello World"
I've decided to use S3 as a platform for learning Ruby. I've managed to figure out enough of the simple access control stuff to load a simple "Hello World" page accessible to the world. It's at s3.amazonaws.com/billstclair/index.html. I created it with the following (in real code, you'd check the responses for errors):
# Fill in your access codes here
AWS_ACCESS_KEY_ID = 'put yours here'
AWS_SECRET_ACCESS_KEY = 'put yours here'
BUCKET = "billstclair" # Choose your own bucket. This one's mine.
# Public read access header
prh = {"x-amz-acl" => "public-read"}
# Create connection
@conn = S3::AWSAuthConnection.new(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, false)
# Create bucket with default private access
# Public access allows anyone to list all the objects with
# http://s3.amazonaws.com/BUCKET
response = @conn.create_bucket(BUCKET)
# You could change the bucket to public-read access by recreating it.
# This does NOT remove any objects in the bucket.
# response = @conn.create_bucket(BUCKET, prh)
# Create the hello world page with public-read access
response = @conn.put(BUCKET, "index.html", "Hello World", prh)
I'm going to work towards moving my 911 Timeline mirror over to S3. Should save me some bucks.
BTW, Amazon's sample Ruby S3 library is here.
Previous Posts:
How Hardyville Fell Off the Map
New Poll Finds 86 Percent Of Americans Don't Want To Have A Country Anymore
S3 Appears to Work
Zfone
Douglas County's attempt to muzzle press hits buzz saw of opposition
Amazon: Grid Storage Web Service Launches
Windoze Sux More
New York's Finest
Honda Accord Ad
The Story of H