Guest User

Untitled

a guest
Oct 19th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'aws-sdk'
  4.  
  5. options = {
  6. :access_key_id => 'AWS_ACCESS_KEY',
  7. :secret_access_key => 'AWS_SECRET_ACCESS_KEY',
  8. :dynamo_db_endpoint => 'dynamodb.ap-northeast-1.amazonaws.com',
  9. }
  10.  
  11. dynamo_db = AWS::DynamoDB.new(options)
  12. table = dynamo_db.tables['test']
  13. table.load_schema
  14.  
  15. # fetching today's log
  16. table.items.where(:time).begins_with(Time.now.strftime('%Y-%m-%d')).each{|item|
  17. item.attributes.each {|key, value|
  18. puts "#{key}: #{value}"
  19. }
  20. }
Add Comment
Please, Sign In to add comment