A simple python 3 script to copy dynamodb table
- Python 3.x
- boto (
pip install boto
)
A simple usage example:
$ python dynamodb-copy-table.py src_table dst_table
The following environment variables can be used:
Variable | Purpose |
---|---|
AWS_DEFAULT_REGION |
Select the region (the default region is us-west-2 ) |
DISABLE_CREATION |
Disable the creation of a new table (Useful if the table already exists) |
DISABLE_DATACOPY |
Disable the copying of data from source table to destination table |
$ AWS_DEFAULT_REGION=us-east-1 DISABLE_CREATION=yes DISABLE_DATACOPY=yes \
python dynamodb-copy-table.py src_table dst_table
The docker image is available as techgaun/dynamodb-copy-table:latest in the official docker hub that you can pull from.
Usage:
# pull image down
docker pull techgaun/dynamodb-copy-table:latest
# invoke help
$ docker run --rm -it techgaun/dynamodb-copy-table:latest
Usage: dynamodb-copy-table.py <source_table_name> <destination_table_name>
# invoke copy
docker run -e AWS_ACCESS_KEY_ID=abc -e AWS_SECRET_ACCESS_KEY=def --rm -it techgaun/dynamodb-copy-table:latest src dest