Skip to content

Instantly share code, notes, and snippets.

@GRGSIBERIA
Created February 3, 2014 20:51
Show Gist options
  • Save GRGSIBERIA/8792126 to your computer and use it in GitHub Desktop.
Save GRGSIBERIA/8792126 to your computer and use it in GitHub Desktop.
#-*- encoding: utf-8
require "aws-sdk"
require "./helpers.rb"
db = dynamodb_client(:tokyo)
db.client.create_table(
:table_name => "test",
:attribute_definitions => [
{:attribute_name => "name", :attribute_type => "S"},
{:attribute_name => "number", :attribute_type => "N"},
{:attribute_name => "comment", :attribute_type => "S"}
],
:key_schema => [
{:attribute_name => "number", :key_type => "HASH"},
{:attribute_name => "name", :key_type => "RANGE"}
],
:global_secondary_indexes => [
{:index_name => "name-number-global-index"},
{:key_schema => [
{:attribute_name => "name", :key_type => "HASH"},
{:attribute_name => "number", :key_type => "RANGE"}
]},
{:projection => {:projection_type => "ALL"}},
{:provisioned_throughput => {
:read_capacity_units => 1,
:write_capacity_units => 1}
}
],
:provisioned_throughput => {
:read_capacity_units => 1,
:write_capacity_units => 1
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment