Close

AWS API Gateway to DynamoDB

A project log for FIMble

Concept of a plug-and-play IoT food monitoring system. It aims to reduce food wastage at consumer and distributor level

zst123zst123 07/04/2020 at 06:440 Comments

Since my app is of a food tracking system, I eventually need to implement an Android app to show an overview of what is inside the fridge inventory.

I am planning for a HTTP API for (perhaps) an Android App to access. The request flow will be like this.

I will try out AWS API Gateway today to retrieve contents in the AWS DynamoDB database.

(1) Create Lambda to be invoked by API Gateway.

Go to Lambda console

After creating the lambda go to IAM console

(2) Create API Gateway and integrate it to Lambda

Navigate to the API Gateway service console, and choose Create API. In API name, type CommentsApi and type a short description. Finally, choose Create API.

Create a route

Create and attach and integration

(3) Edit Lambda to parse DynamoDB items

I used the document client to scan for the table name. This retrieves all the items without any filters. Perhaps I'll add a filter parameter in if I need it in the future part of this project.

And now, I can go to the /retrieve page and I see all the test entry in my database.

For next time, I want to do up the android app and also the RFID portion of the PSoC device.

Discussions