A Seneca.js data storage plugin
seneca-dynamo-store is an Amazon DynamoDB database driver for the Seneca MVP toolkit.
npm install --save seneca-dynamo-store
var seneca = require('seneca');
var senecaDynamoDBStore = require('seneca-dynamo-store');
var senecaConfig = {}
var senecaDynamoDBStoreOpts = {
accessKeyId: 'ACCESSKEYID',
secretAccessKey: 'SECRETACCESSKEY',
endpoint: 'ENDPOINT',
region: 'REGION' // e.g. 'us-east-1'
};
...
var si = seneca(senecaConfig);
si.use(senecaDynamoDBStore, senecaDynamoDBStoreOpts);
si.ready(function() {
var product = si.make('product');
...
});
...
You will need to have an AWS account (obviously!).
- Go to
https://console.aws.amazon.com/dynamodb/home
- The URL will be automatically be rewritten to add your Region, e.g.
https://console.aws.amazon.com/dynamodb/home?region=us-east-1
- Your Endpoint will be
https://dynamodb.us-east-1.amazonaws.com
e.g.https://dynamodb.us-east-1.amazonaws.com
- Log into the AWS IAM Console
- Press Users (on the left)
- Press Create New Users (button on the top). This is optional but highly recommended
- Enter a username, e.g. awsdynamodb_root. Make sure the "Generate Access Keys" box is selected
- Press Show User Security Credentials
- Store the "Access Key" and the "Secret Access Key" in a secure place. This is your only opportunity to get the Secret Access Key, so make sure you do this now.
You'll still need to create a Policy and attach it to the User you just created in order to be able to access DynamoDB.
Still in the AWS IAM Console
-
Press Policies (on the left)
-
Press Create Policy (button on the top)
-
Press the Create Your Own Policy button
-
Enter Policy Name
DynamoDBRoot
(or whatever) -
Add this Policy Document
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "dynamodb:*" ], "Effect": "Allow", "Resource": [ "*" ] } ] }
-
Press Create Policy
- Find the DynamoDBRoot policy (Filter is your friend)
- Click on it
- Press tab Attached Entities
- Press button Attach
- Click radio box for awsdynamodb_root (the user we created earlier)
- Press Attach Policy button (near bottom)
The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.
Copyright Seamus D'Arcy and other contributors 2010 - 2016, Licensed under MIT.