Last active
January 4, 2016 19:08
-
-
Save teohm/8664915 to your computer and use it in GitHub Desktop.
DynamoDB Local connection sample.
This file contains hidden or 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
dynamo_db_config = { | |
api_version: '2012-08-10', | |
access_key_id: ENV['AWS_ACCESS_KEY_ID'], | |
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], | |
} | |
dynamo_db_config.merge!( | |
use_ssl: false, | |
dynamo_db_endpoint: 'localhost', | |
dynamo_db_port: 8000 | |
) | |
client = AWS::DynamoDB::Client.new(dynamo_db_config) | |
resp = client.create_table( | |
attribute_definitions: [ | |
{ | |
attribute_name: 'pg_id', | |
attribute_type: 'S' | |
} | |
], | |
table_name: "MyTable", | |
key_schema: [ | |
{ | |
attribute_name: 'pg_id', | |
key_type: "HASH" | |
} | |
], | |
provisioned_throughput: { | |
read_capacity_units: 100, | |
write_capacity_units: 100 | |
} | |
) | |
p resp |
This file contains hidden or 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
java -Djava.library.path=/Users/huiming/bin/dynamodb_local_2014-01-08/DynamoDBLocal_lib -jar ~/bin/dynamodb_local_2014-01-08/DynamoDBLocal.jar -dbPath ./db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment