Skip to content

Instantly share code, notes, and snippets.

@jwillesen
Created May 12, 2014 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jwillesen/7552a515daff571bf407 to your computer and use it in GitHub Desktop.
Save jwillesen/7552a515daff571bf407 to your computer and use it in GitHub Desktop.
require 'aws-sdk'
require 'securerandom'
require 'pp'
$dynamo = AWS::DynamoDB.new(
access_key_id: 'blah',
secret_access_key: 'blah/blah/blah',
)
$table = $dynamo.tables['some-table-name-here']
$table.load_schema
def create_and_find()
session_id = SecureRandom.uuid
puts "creating #{session_id}"
session = $table.items.create('sid' => session_id)
puts "created session #{session.attributes['sid']}"
found_session = $table.items[session_id]
puts "found_session:"
pp found_session.attributes.to_hash(consistent_read: true)
end
25.times { create_and_find }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment