Skip to content

Commit dcf258e

Browse files
committed
chore: update readme
1 parent 7a9505c commit dcf258e

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
# dynamodump
22

3-
![Linting Status](https://github.com/bchew/dynamodump/workflows/Linting/badge.svg) ![Test Status](https://github.com/bchew/dynamodump/workflows/Test/badge.svg) [![DockerBuildstatus](https://img.shields.io/docker/build/bchew/dynamodump.svg)](https://hub.docker.com/r/bchew/dynamodump/)
3+
[![PyPI version](https://badge.fury.io/py/dynamodump.svg)](https://badge.fury.io/py/dynamodump)
4+
![Linting Status](https://github.com/bchew/dynamodump/workflows/Linting/badge.svg)
5+
![Test Status](https://github.com/bchew/dynamodump/workflows/Test/badge.svg)
46

57
Simple backup and restore script for Amazon DynamoDB using AWS SDK for Python (boto3) to work similarly to mysqldump.
68

79
Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS Data Pipeline for backup/restores/empty.
810

911
dynamodump supports local DynamoDB instances as well (tested with [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)).
1012

13+
## Installation
14+
15+
```
16+
pip install dynamodump
17+
```
18+
1119
## Usage
1220

1321
```
14-
usage: dynamodump/dynamodump.py [-h] [-a {zip,tar}] [-b BUCKET]
22+
usage: dynamodump [-h] [-a {zip,tar}] [-b BUCKET]
1523
[-m {backup,restore,empty}] [-r REGION] [--host HOST]
1624
[--port PORT] [--accessKey ACCESSKEY]
1725
[--secretKey SECRETKEY] [-p PROFILE] [-s SRCTABLE]
@@ -96,73 +104,73 @@ As of v1.2.0, note that `--noConfirm` is required to perform data restores invol
96104
Single table backup/restore:
97105

98106
```
99-
python dynamodump/dynamodump.py -m backup -r us-west-1 -s testTable
107+
dynamodump -m backup -r us-west-1 -s testTable
100108
101-
python dynamodump/dynamodump.py -m restore -r us-west-1 -s testTable
109+
dynamodump -m restore -r us-west-1 -s testTable
102110
```
103111

104112
Multiple table backup/restore (assumes prefix of 'production-' of table names, use --prefixSeparator to specify a
105113
different separator):
106114

107115
```
108-
python dynamodump/dynamodump.py -m backup -r us-west-1 -s production*
116+
dynamodump -m backup -r us-west-1 -s production*
109117
110-
python dynamodump/dynamodump.py -m restore -r us-west-1 -s production*
118+
dynamodump -m restore -r us-west-1 -s production*
111119
```
112120

113121
The above, but between different environments (e.g. production-_ tables to development-_ tables):
114122

115123
```
116-
python dynamodump/dynamodump.py -m backup -r us-west-1 -s production*
124+
dynamodump -m backup -r us-west-1 -s production*
117125
118-
python dynamodump/dynamodump.py -m restore -r us-west-1 -s production* -d development*
126+
dynamodump -m restore -r us-west-1 -s production* -d development*
119127
```
120128

121129
Backup all tables and restore only data (will not delete and recreate schema):
122130

123131
```
124-
python dynamodump/dynamodump.py -m backup -r us-west-1 -s "*"
132+
dynamodump -m backup -r us-west-1 -s "*"
125133
126-
python dynamodump/dynamodump.py -m restore -r us-west-1 -s "*" --dataOnly
134+
dynamodump -m restore -r us-west-1 -s "*" --dataOnly
127135
```
128136

129137
Dump all table schemas and create the schemas (e.g. creating blank tables in a different AWS account):
130138

131139
```
132-
python dynamodump/dynamodump.py -m backup -r us-west-1 -p source_credentials -s "*" --schemaOnly
140+
dynamodump -m backup -r us-west-1 -p source_credentials -s "*" --schemaOnly
133141
134-
python dynamodump/dynamodump.py -m restore -r us-west-1 -p destination_credentials -s "*" --schemaOnly
142+
dynamodump -m restore -r us-west-1 -p destination_credentials -s "*" --schemaOnly
135143
```
136144

137145
Backup all tables based on AWS tag `key=value`
138146

139147
```
140-
python dynamodump/dynamodump.py -p profile -r us-east-1 -m backup -t KEY=VALUE
148+
dynamodump -p profile -r us-east-1 -m backup -t KEY=VALUE
141149
```
142150

143151
Backup all tables based on AWS tag, compress and store in specified S3 bucket.
144152

145153
```
146-
python dynamodump/dynamodump.py -p profile -r us-east-1 -m backup -a tar -b some_s3_bucket -t TAG_KEY=TAG_VALUE
154+
dynamodump -p profile -r us-east-1 -m backup -a tar -b some_s3_bucket -t TAG_KEY=TAG_VALUE
147155
148-
python dynamodump/dynamodump.py -p profile -r us-east-1 -m backup -a zip -b some_s3_bucket -t TAG_KEY=TAG_VALUE
156+
dynamodump -p profile -r us-east-1 -m backup -a zip -b some_s3_bucket -t TAG_KEY=TAG_VALUE
149157
```
150158

151159
Restore from S3 bucket to specified destination table
152160

153161
```
154162
## source_table identifies archive file in S3 bucket from which backup data is restored
155-
python dynamodump/dynamodump.py -a tar -b some_s3_bucket -m restore -r us-east-1 -p profile -d destination_table -s source_table
163+
dynamodump -a tar -b some_s3_bucket -m restore -r us-east-1 -p profile -d destination_table -s source_table
156164
```
157165

158166
## Local example
159167

160168
The following assumes your local DynamoDB is running on localhost:8000 and is accessible via 'a' as access/secret keys.
161169

162170
```
163-
python dynamodump/dynamodump.py -m backup -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
171+
dynamodump -m backup -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
164172
165-
python dynamodump/dynamodump.py -m restore -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
173+
dynamodump -m restore -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
166174
```
167175

168176
Multiple table backup/restore as stated in the AWS examples are also available for local.

dynamodump/dynamodump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS
66
Data Pipeline for backup/restores/empty.
77
8-
dynamodump supports local DynamoDB instances as well (tested with dynalite).
8+
dynamodump supports local DynamoDB instances as well (tested with DynamoDB Local).
99
"""
1010

1111
import argparse

0 commit comments

Comments
 (0)