Project

dyna

0.0
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
Manager DynamoDB table by DSL
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 12.3.3
~> 3.0

Runtime

 Project Readme

Dyna

Dyna is a tool to manage DynamoDB Table.

It defines the state of DynamoDB Table using DSL, and updates DynamoDB Table according to DSL.

Installation

Add this line to your application's Gemfile:

gem 'dyna'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dyna

Usage

export AWS_ACCESS_KEY_ID='...'
export AWS_SECRET_ACCESS_KEY='...'
export AWS_REGION='ap-northeast-1'
dyna -e -o Dynafile  # export DynamoDB Table
vi Dynafile
dyna -a --dry-run
dyna -a               # apply `Dyanfile` to DynamoDB

Help

Usage: dyna [options]
    -p, --profile PROFILE_NAME
        --credentials-path PATH
    -k, --access-key ACCESS_KEY
    -s, --secret-key SECRET_KEY
    -r, --region REGION
        --endpoint DYNAMO_ENDPOINT
    -a, --apply
    -f, --file FILE
    -n, --table_names TABLE_LIST
    -x, --exclude_table_names TABLE_LIST
        --dry-run
    -e, --export
    -o, --output FILE
        --split
        --no-color
        --debug

Dynafile example

require 'other/dynafile'

dynamo_db "ap-northeast-1" do
  table "test_table" do
    key_schema(
      hash: "ForumName",
      range: "Subject"
    )

    attribute_definition(
      attribute_name: "ForumName",
      attribute_type: "S",
    )
    attribute_definition(
      attribute_name: "Subject",
      attribute_type: "S",
    )

    time_to_live_specification(
      enabled: true,
      attribute_name: "ttl",
    )

    provisioned_throughput(
      read_capacity_units: 1,
      write_capacity_units: 2,
    )

    local_secondary_index "LocalIndexName" do
      key_schema hash: "ForumName", range: "Subject"
      projection projection_type: "ALL"
    end

    global_secondary_index "GlobalIndexName" do
      key_schema hash: "ForumName", range: "Subject"
      projection projection_type: "ALL"
      provisioned_throughput read_capacity_units: 1, write_capacity_units: 2
    end

    stream_specification(
      stream_enabled: true,
      stream_view_type: "NEW_AND_OLD_IMAGES",
    )
 end

Similar tools

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wata-gh/dyna.

License

The gem is available as open source under the terms of the MIT License.