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 Resposta
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
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas