Skip to content

Instantly share code, notes, and snippets.

@yuasatakayuki
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuasatakayuki/a70db1619f0091f16efb to your computer and use it in GitHub Desktop.
Save yuasatakayuki/a70db1619f0091f16efb to your computer and use it in GitHub Desktop.
Ruby Fog::AWS::SimpleDB Example
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