Lambda that parses data into attributes?

0

I'm sending with ajax, a payload of data and then i have a lambda setup to take that data and parse it into attributes to store into my dynamoDB.

this is my github showing my index.js(lambda function) and my jque.js(file that is sending the data to the lambda via api gateway). https://github.com/dbaldw10/DynamoDWLambdaAWS

is there a way to achieve this?

1 Answer
1

This tutorial should help you out: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-dynamo-db.html

Your current code appears to do most of this already - you just need to refactor to use a Lambda handler function and get the request body from the event object:

exports.handler = async (event, context) => {
  ...
  let requestJSON = JSON.parse(event.body);
  ...
}

You should then be able to replace the hardcoded values being added to DynamoDB with the data being sent in the request.

Ed
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions