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 Risposta
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
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande