Created
January 21, 2012 02:35
-
-
Save arfon/1650887 to your computer and use it in GitHub Desktop.
AWS DynamoDB table creation (composite primary_key)
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 'aws-sdk' | |
AWS_ACCESS_KEY = 'your_aws_access_key' | |
AWS_SECRET_KEY = 'your_aws_secret_key' | |
dynamo_db = AWS::DynamoDB.new(:access_key_id => AWS_ACCESS_KEY, :secret_access_key => AWS_SECRET_KEY) | |
# create a table (50 read and 50 write capacity units) | |
# create composite index using hash_key (:user_id) and range_key (:created_at) | |
table = dynamo_db.tables.create("tweets", 50, 50, | |
:hash_key => { :user_id => :number }, | |
:range_key => { :created_at => :number }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment