Skip to content

kingshuknandy2016/aws-serverless-crud-api-microservice

Repository files navigation

AWS Serverless CRUD APIs of E-Commerce Product Microservices

NodeJS AmazonDynamoDB AWS

This is a AWS Serverless CRUD API Project. Here we have developed a E-commerce Product Microservice which reads,create,update and delete e-commerce products from DynamoDB Table.

Features

  • AWS API Gateway for RESTful API's
  • AWS Lambda Synchronous Invocation
  • AWS DynamoDB for Persistent Data Storage
  • Standard CRUD Operations

Architecture

Microservices-Built-With-Node-1

Application Flow

  • The client send requests to our microservices by making HTTP API Calls
  • Amazon API Gateway hosts the RESTful HTTP request. The client API calls reaches here.
  • After matching the user routes the api gateway passes the events to the Product Lambda Service.
  • The Lambda contains the business logic to process the incoming events.
  • After performing the necessary operations it passes the desired object to Amazon DynamoDB which stores microservices data and scales based on demand.

Steps

  • Create a Product Table in AWS DynamoDB using DynamoDB Console

  • create a Lambda function using the AWS Lambda console.

  • Create a API Gateway for Product Microservices

Product Gateway API Design

# Root Name
+-----------+
   product
+-----------+

# And under this name, we have GET and POST methods
+--------+-----------+
  Method | URI
+--------+-----------+
  GET    | /product
  POST   | /product
+--------+-----------+


# And we have single product with id parameters
product.addResource('{id}');

+--------+---------------+
  Method | URI
+--------+---------------+
  GET    | /product/{id}
  PUT    | /product/{id}
  DELETE | /product/{id}
+--------+---------------+

After creating the basic API Gate way it looks like following

API Gateway Raw

And after creating the dev stage it looks like

API Gateway With Stages(Environment)

All the API invocation logs are stored in Amazon Cloud Watch Logs. We have copied them and paste it here