Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to copy to/from local dynamodb #16

Closed
cdelgadob opened this issue Jan 31, 2019 · 2 comments
Closed

How to copy to/from local dynamodb #16

cdelgadob opened this issue Jan 31, 2019 · 2 comments

Comments

@cdelgadob
Copy link

Is it possible to use a local dynamodb as a source or target?

@all9lives
Copy link

I have the same question, it would be great to be able to use this to copy from AWS to local.

@enGMzizo
Copy link
Owner

You can copy Dynamodb table from local to AWS and vice versa using the correct config
For example I want to copy test_table from AWS to local I would provide the following config you the copy() function in destination config

const sourceAWSConfig = {
  accessKeyId: process.env.AWS_ACCESS_KEY_ID,
  secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  region: 'us-east-1',
};

var destinationAWSConfig = {
  accessKeyId: 'AKID',
  secretAccessKey: 'SECRET',
  endpoint: "http://localhost:8000", // use the local dynamodb url here
  region: 'us-west-2' 
}

copy({
  source: {
    tableName: 'test_table',
    config: sourceAWSConfig
  },
  destination: {
    config: destinationAWSConfig,
    tableName: 'copy_test_table',
  },
  log: true,
  create: true,
}, function (err, result) {
  if (err) {
    console.log(err);
  }
  console.log(result);
});

Also it supports coping from local db to AWS if you reversed the config in previous example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants