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개 답변
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
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠