2021年4月24日星期六

CRUD from Alexa Developer Console to AWS hosted DynamoDB

I have connected to my Alexa Developer Console to AWS hosted DynamoDB using:

 ​ // 1. Assume the AWS resource role using STS AssumeRole Action      const STS = new AWS.STS({ apiVersion: '2012-10-17' });      const credentials = await STS.assumeRole({          RoleArn: 'arn:aws:iam::836374152057:role/OpenCareQuestionnaire',          RoleSessionName: 'SaveBathingSlot' // You can rename with any name      }, (err, res) => {          if (err) {              console.log('AssumeRole FAILED: ', err);              throw new Error('Error while assuming role');          }          return res;      }).promise();            const dynamoDB = new AWS.DynamoDB({              apiVersion: '2012-08-10',              accessKeyId: credentials.Credentials.AccessKeyId,              secretAccessKey: credentials.Credentials.SecretAccessKey,              sessionToken: credentials.Credentials.SessionToken          });            const tableData = await dynamoDB.scan({ TableName: 'my-care-questionnaire' }, (err, data) => {          if (err) {              console.log('Scan FAILED', err);              throw new Error('Error while scanning table');          }          console.log(data);      }).promise();​  

following this link: https://developer.amazon.com/en-US/docs/alexa/hosted-skills/alexa-hosted-skills-personal-aws.html

Although I can see my data from:

console.log(data)  

but I can't seem to do CRUD from my Alexa Developer Console.

I also tried

​var docClient = new AWS.DynamoDB.DocumentClient();  

but it doesn't seem to connect to my AWS hosted DynamoDB.

The document seems a little incomplete to me and I am wondering if it's possible to do CRUD from Alexa Developer Console to my AWS hosted DynamoDB.

Thank you.

https://stackoverflow.com/questions/67237984/crud-from-alexa-developer-console-to-aws-hosted-dynamodb April 24, 2021 at 07:40AM

没有评论:

发表评论