amazon web services – How to access dynamodb generated by graphql model in lambda function and perform operations?

I am very new to aws and I am having a hard time understanding the process between lambda function and the dynamoDB. I followed this documentation.

According to the documentaion this trigger is used to get the records of the tables from dynamodb.

exports.handler = function (event, context) {
  console.log(JSON.stringify(event, null, 2));
  event.Records.forEach((record) => {
    console.log(record.eventID);
    console.log(record.eventName);
    console.log('DynamoDB Record: %j', record.dynamodb);
  });
  context.done(null, 'Successfully processed DynamoDB record');
};

And the event is coming from the ‘event.json’ file. Which is this:

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

What I want to accomplished is to retrieve and update the data of my dynamodb ‘User’ table which is from this graphql model.

type User @model @auth(rules: [{allow: owner, operations: [create, update]}]){
    id: ID!
    coins: Int
}

Read more here: Source link