Comments (1)
You need to use the promise version mentioned in this comment
#12 (comment)
and update your code to support it.
var copy = require('copy-dynamodb-table').copy;
function promiseCopy(data) {
return new Promise((resolve, reject) => {
copy(data, function (err, result) {
if (err) {
return reject(err)
}
resolve(result)
})
})
}
var globalAWSConfig = {
accessKeyId: 'MYKEY',
secretAccessKey: 'MYSECRET',
region: 'eu-west-1'
};
async function copyTable( from, to ) {
console.info( "Copying table " + from + " to " + to );
await promiseCopy({
config: globalAWSConfig,
source: {
tableName: from, // required
},
destination: {
tableName: to, // required
},
log: true, // default false
create : true // create destination table if not exist
});
console.info( "Done?");
}
exports.handler = async (event) => {
console.info( event );
await copyTable( "my-source-table-dev", "my-target-table-live" );
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
from copy-dynamodb-table.
Related Issues (20)
- TypeError: fn is not a function HOT 2
- How to use promise HOT 1
- Dynamodb OnDemand pricing model changes
- How to copy to/from local dynamodb HOT 2
- A valid table name is considered invalid due to the table name validation
- Add support for ondemand dynamodb tables HOT 8
- Read config from .aws/config
- DynamoDB WCU is not utilized HOT 6
- LSI ProvisionedThroughput is not existed HOT 1
- Across Account HOT 1
- Copy only schema HOT 2
- Seems to fail when copying from a global replicated table HOT 2
- Callback function is not called HOT 2
- RCU and WCU not used HOT 1
- Possible to bubble up aws-sdk errors? HOT 1
- Getting error " Unexpected key 'TableClassSummary' found in params " while running the code.
- How to copy data from/to multiple tables at once?
- How to specify item limit when copying
- How to filter the data being copied?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from copy-dynamodb-table.