Last active
August 29, 2015 14:13
-
-
Save yuasatakayuki/a70db1619f0091f16efb to your computer and use it in GitHub Desktop.
Ruby Fog::AWS::SimpleDB Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "fog" | |
#Create a Fog AWS SimpleDB instance | |
sdb = Fog::AWS::SimpleDB.new( | |
:aws_access_key_id => "YOUR_ACCESS_KEY_ID", | |
:aws_secret_access_key => "YOUR_SECRET_ACCESS_KEY", | |
:region => "ap-northeast-1" #meaning "Tokyo" | |
) | |
#Create domain | |
domainName="glacier" | |
sdb.create_domain(domainName) | |
#Put an item | |
itemName="sampleItem" | |
attributes={:color=>"blue", :price=>"500"} | |
sdb.put_attributes(domainName,itemName,attributes) | |
# | |
sleep 5 | |
#Get the item that was just put | |
result=sdb.select("select * from #{domainName}") | |
puts result.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment