Skip to main content

Dyn CLI - DynamoDB Command Line Interface

Project description

# dyn-cli

Command Line Interface for Dynamo DB

Content:

* [Installation](#installation)
* [Usage](#usage)
* [Commands](#commands)
+ [List tables](#list-tables)
+ [Create table](#create-table)
+ [Update table](#update-table)
+ [Delete table](#delete-table)
* [Examples](#examples)

## Installation

The easiest way to install dyn-cli is to use [pip](https://pip.pypa.io//en/latest/):

```bash
$ pip install dyncli
```

## Usage

Synopsis:

```bash
$ dyn [OPTIONS] COMMAND [ARGS]...
```

List of commands:

* [List tables](#list-tables)
* [Create table](#create-table)
* [Update table](#update-table)
* [Delete table](#delete-table)

### Options

You can configure your AWS credentials via options. The following table shows these options.

| Option | Description |
|-------------------------------------|------------------------------------------------------------------------------|
| `-a`, `--access-key AWS_ACCESS_KEY` | AWS Access Key ID. (default: local) |
| `-s`, `--secret-key AWS_SECRET_KEY` | AWS Secret Key. (default: local) |
| `-r`, `--region AWS_REGION` | AWS Region. (default: us-east-1) |
| `-n`, `--no-local` | Disable local endpoint_url set up to http://localhost:8000. (default: false) |
| `-h`, `--help` | Show help message. |

## Commands

### List tables

List all tables of DynamoDB.

```bash
$ dyn list_tables
```

### Create table

Creates a DynamoDB table with `TABLE` name and attributes defined in `ATTRIBUTE`.

```bash
$ dyn create_table [OPTIONS] TABLE ATTRIBUTE [ATTRIBUTE]...
```

#### Options

| Option | Description |
|-------------------------------------|------------------------------------------------------------------------------|
| `-r`, `--read-units INTEGER` | Read capacity units. (default: 1) |
| `-w`, `--write-units INTEGER` | Write capacity units. (default: 1) |

#### Atrributes

The `ATTRIBUTE` argument can be defined like: `name:type[:pk][:sk]`

* _name_ - name of attribute.
* _type_ - type of attribute that can be:
+ `s` - string
+ `n` - number
+ `b` - binary
* `pk` - first attribute of primary key (partition key - HASH)
* `sk` - second attribute of primary key (sort key - RANGE)

### Update table

Modifies a DynamoDB table with TABLE name.

```bash
$ dyn update_table [OPTIONS] TABLE
```

#### Options

| Option | Description |
|-------------------------------------|------------------------------------------------------------------------------|
| `-r`, `--read-units INTEGER` | Read capacity units. (default: 1) |
| `-w`, `--write-units INTEGER` | Write capacity units. (default: 1) |

### Delete table

Deletes a table of DynamoDB.

```bash
$ dyn delete_table TABLE
```

## Examples

Listing all tables:

```bash
$ dyn list_tables
```

```json
{
"TableNames": [
"Movies",
"Music"
]
}
```

Creating Music table:

```bash
$ dyn create_table Music Artist:s:pk SongTitle:s:sk
```

```json
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "Artist",
"AttributeType": "S"
},
{
"AttributeName": "SongTitle",
"AttributeType": "S"
}
],
"CreationDateTime": "2017-07-02T23:19:52.932000-03:00",
"ItemCount": 0,
"KeySchema": [
{
"AttributeName": "Artist",
"KeyType": "HASH"
},
{
"AttributeName": "SongTitle",
"KeyType": "RANGE"
}
],
"ProvisionedThroughput": {
"LastDecreaseDateTime": "1969-12-31T21:00:00-03:00",
"LastIncreaseDateTime": "1969-12-31T21:00:00-03:00",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Music",
"TableName": "Music",
"TableSizeBytes": 0,
"TableStatus": "ACTIVE"
}
}
```

Updating Music table:

```bash
$ dyn update_table Music -r 10 -w 10
```

```javascript
{
"TableDescription": {
"AttributeDefinitions": [
{
"AttributeName": "Artist",
"AttributeType": "S"
},
{
"AttributeName": "SongTitle",
"AttributeType": "S"
}
],
"CreationDateTime": "2017-07-02T23:19:52.932000-03:00",
"ItemCount": 0,
"KeySchema": [
{
"AttributeName": "Artist",
"KeyType": "HASH"
},
{
"AttributeName": "SongTitle",
"KeyType": "RANGE"
}
],
"ProvisionedThroughput": {
"LastDecreaseDateTime": "1969-12-31T21:00:00-03:00",
"LastIncreaseDateTime": "1969-12-31T21:00:00-03:00",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 10,
"WriteCapacityUnits": 10
},
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Music",
"TableName": "Music",
"TableSizeBytes": 0,
"TableStatus": "ACTIVE"
}
}
```

Deleting Music table:

```bash
$ dyn delete_table Music
```

```json
{
"TableDescription": {
"ItemCount": 0,
"ProvisionedThroughput": {
"LastDecreaseDateTime": "1969-12-31T21:00:00-03:00",
"LastIncreaseDateTime": "1969-12-31T21:00:00-03:00",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 10,
"WriteCapacityUnits": 10
},
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/Music",
"TableName": "Music",
"TableSizeBytes": 0,
"TableStatus": "DELETING"
}
}
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dyn-cli-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dyn_cli-0.1.0-py2.py3-none-any.whl (8.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dyn-cli-0.1.0.tar.gz.

File metadata

  • Download URL: dyn-cli-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for dyn-cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68b32cde048611229f708cc2db9f6c4d2c8369fcc8c8d0bb559967c1edbba0bf
MD5 fb76fe14e0228397f3a9c5ebf0a5fa9d
BLAKE2b-256 e03bc0c9de6f5614b7ee95549b154f9e763133be66616cd5898cedca7afea065

See more details on using hashes here.

File details

Details for the file dyn_cli-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: dyn_cli-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for dyn_cli-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c2e6f8d591fbb9ac489d5ba12bdc9fd6fcc1e96a79cb33f31ddd22e3e1314d8d
MD5 1f0057d0a0a8b34ee97024769add621c
BLAKE2b-256 598bb0fcd6aaccc96448c3fcd47bc28113f8f15a17cd2db500d7ff3fd657b44e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page