0
votes

I been following this tutorial to create an Post and GET api as proxy to write to my dynamo DB. https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/

I got the post api working internally however, when I deploy it live, the GET works perfectly, however, the post does not write to the DB.

Table Name: License Plate Response of the Post request

the URI is Iteration3/LicensePlateNumber/{LicensePlateNumber} 

and this is how I am passing the values.

/Iteration3/LicensePlateNumber/{"Actual_License_PlateNumber" :"testfrombrowser}

but nothing is being inputted to dyanmo db.

1

1 Answers

0
votes

It looks like you have not given closing " with the value testfrombrowser. See the example with the values you passed.

/Iteration3/LicensePlateNumber/{"Actual_License_PlateNumber" :"testfrombrowser}

It should be:

/Iteration3/LicensePlateNumber/{"Actual_License_PlateNumber" :"testfrombrowser"}

May be that is a typo mistake. Check below things.

  • Turn on log/tracing from stage editor and see cloudwatch logs for on apigateway execution.
  • Make sure that while defining AWS Proxy integration, execution Role (IAM role) mentioned for PutItem action has sufficient permissions on DynamoDb.
  • Also make sure that you are executing APIgateway POST method correctly.

See an example curl call.

curl -X POST -H "x-api-key: theKey" -H "Content-Type: application/json" -d '{"Actual_License_PlateNumber":"testfrombrowser"}' https://[api--id].execute-api.[region].amazonaws.com