0

I am trying to use apiGateway as proxy to dynamodb but for some reason the integration returns 404.

I have created a patch method resource in apiGateway. and used below data in integration mappingTemplate for testing:

{
    "TableName": "Retool_Output",
    "Item": {
        "customerId": "1234",
        "fav_movies": "Shalini"
    }
}

but when i test this gateway, it does not update dynamodb and give 404 as shown below.

Tue Aug 06 17:03:56 UTC 2019 : Endpoint request body after 
transformations: {
    "TableName": "Retool_Output",
    "Item": {
        "customerId": "1234",
        "fav_movies": "Shalini"
    }
}
Tue Aug 06 17:03:56 UTC 2019 : Sending request to https://dynamodb.ap- 
south-1.amazonaws.com//
Tue Aug 06 17:03:56 UTC 2019 : Received response. Status: 404, Integration 
latency: 13 ms

Can someone suggest me how to resolve this issue.

9
  • Are you sure the url path is /? Haven't you configured an extra path like /add-item? Commented Aug 6, 2019 at 18:14
  • no i have not configured extra path. it's / only. Commented Aug 6, 2019 at 18:16
  • Have you deployed your stage? In the aws console there's a button "deploy api". It won't work if you didn't do that. Commented Aug 6, 2019 at 18:18
  • For some reason i am not able to create a stage. The deployment field is giving empty list. Commented Aug 6, 2019 at 18:34
  • Where are you trying to create it? On the console? (website) Commented Aug 6, 2019 at 18:39

1 Answer 1

5

Found the answer to the question. Basically we have to use POST method with action as PutItem for adding an item in dynamodb via apiGateway whereas I was using PUT method.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes we must "choose POST for the HTTP method since all DynamoDB Queries are POST": aws.amazon.com/blogs/compute/…
You got "404 Not Found" before because there is no non-POST endpoint to be found (for a DynamoDB Query).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.