Small NodeJS solution to copy content between two DynamoDB tables.
AWS DynamoDB does not support renaming tables or easy copying of content between two DynamoDB tables.
So this is a small dumb script that scans the whole table (mind the consumed capacity) and uses batchWrite to insert into the target table.
AWS Batch Write has two restrictions - max 25 items and 400kb per write. The later is not supported :S
Node >=13 due to import syntax
npm i
or yarn
TABLEFROM
: Name of the source table to scan
TABLETO
: Name of the target table
REGION
: AWS Region for both tables (cross-region is possible, but noy yet)
AWSPROFILE
: Name of the AWS profile on the user account. AWS Key (env?) is not supported yet
node index.js --from TABLEFROM --to TABLETO --region REGION --profile AWSPROFILE
or
npm start -- --from TABLEFROM --to TABLETO --region REGION --profile AWSPROFILE
Example:
npm start -- --from oldTable --to newTable --region us-east-1 --profile default
MIT