Skip to content

Instantly share code, notes, and snippets.

@teohm
Last active January 4, 2016 19:08
Show Gist options
  • Save teohm/8664915 to your computer and use it in GitHub Desktop.
Save teohm/8664915 to your computer and use it in GitHub Desktop.
DynamoDB Local connection sample.
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
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