Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gonsuke
Created June 10, 2012 15:41
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 gonsuke/2906291 to your computer and use it in GitHub Desktop.
Save gonsuke/2906291 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'aws-sdk'
options = {
:access_key_id => 'AWS_ACCESS_KEY',
:secret_access_key => 'AWS_SECRET_ACCESS_KEY',
:dynamo_db_endpoint => 'dynamodb.ap-northeast-1.amazonaws.com',
}
dynamo_db = AWS::DynamoDB.new(options)
table = dynamo_db.tables['test']
table.load_schema
# fetching today's log
table.items.where(:time).begins_with(Time.now.strftime('%Y-%m-%d')).each{|item|
item.attributes.each {|key, value|
puts "#{key}: #{value}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment