Connect to dynamodb Macrometa using mmdynamo
Browser(Javascript) NPM
Install mmdynamo
npm install mmdynamo --save
Import package
import { DynamoDB } from "mmdynamo";
Initialize Dynamodb
import { DynamoDB } from "mmdynamo";
const dcName = "test.macrometa.io";
const host = "https://api-" + dcName;
const apiKey = "xxxxxxxxxxxxxxxxxxxxxx";
/*
If you have a JWT token
const JWT = "xxxxxxxxxxxxxxxxxxxxxx";
*/
const service = "dynamodb";
const region = "us-east-1";
const endpoint = host + "/_api/dynamo";
// secretAccessKey is a required parameter for aws-sdk we recommend you to pass "c8"
const secretAccessKey = "c8";
const accessKeyId = "apikey " + apiKey;
/*
If you are using JWT token use the below instead
const accessKeyId = "bearer " + JWT;
*/
const client = new DynamoDB({
region,
endpoint,
accessKeyId,
secretAccessKey,
});
Browser(Javascrio) as Library
Add mmdynamo
<script src="https://unpkg.com/mmdynamo@0.2.0/dist/mmdynamo.umd.js"></script>
Initialize Dynamodb
<script type="text/javascript">
const dcName = "test.macrometa.io";
const host = "https://api-" + dcName;
const apiKey = "xxxxxxxxxxxxxxxxxxxxxx";
/*
If you have a JWT token
const JWT = "xxxxxxxxxxxxxxxxxxxxxx";
*/
const service = "dynamodb";
const region = "us-east-1";
const endpoint = host + "/_api/dynamo";
// secretAccessKey is a required parameter for aws-sdk we recommend you to pass "c8"
const secretAccessKey = "c8";
const accessKeyId = "apikey " + apiKey;
/*
If you are using JWT token use the below instead
const accessKeyId = "bearer " + JWT;
*/
const { DynamoDB } = window.mmdynamo;
const client = new DynamoDB({
region,
endpoint,
accessKeyId,
secretAccessKey,
});
</script>