Skip to content

sanju2/clinic-api

Repository files navigation

Clinic REST-API

Use following things

  • Node.js
  • AWS Lambda
  • AWS API Gateway
  • AWS APIGateway API Key (For Restrict API Access, also can use Cognito)
  • AWS DynamoDB
  • AWS CodePipeline
  • AWS CodeBuild
  • AWS IAM Roles & Policy
  • Github Repository

See Postman Collection you can Import Collection via link for Invoke APIs. Colection Link - https://www.getpostman.com/collections/7e39f4cd409ca8296420

Architectural Diagram

Architectural Diagram

Create Lambda functions

Create 4 Lambda functions with permisson with DynamoDB

Architectural Diagram

Add following permisson to IAM Role

  • AmazonDynamoDBFullAccess
  • CloudWatchLogsFullAccess

Create API Gateway

Create AWS API GAteway and add following routes API Gateway

Create DynamoDB Tables

DynamoDB Tables

Create 4 dynamodb tables for

  • user
  • admin
  • doctor
  • appointments

Create AWS CodeBuild Build Project

For CICD pipeline create a CodeBuild Project AWS CodeBuild

CodeBuild Service role add following code part

{
  "Effect": "Allow",
  "Action": [
      "lambda:AddPermission",
      "lambda:RemovePermission",
      "lambda:CreateAlias",
      "lambda:UpdateAlias",
      "lambda:DeleteAlias",
      "lambda:UpdateFunctionCode",
      "lambda:UpdateFunctionConfiguration",
      "lambda:PutFunctionConcurrency",
      "lambda:DeleteFunctionConcurrency",
      "lambda:PublishVersion"
  ],
  "Resource": [
    "arn:aws:lambda:{{region}}:{{accountno}}:function:{{user-bucket}}",
    "arn:aws:lambda:{{region}}:{{accountno}}:function:{{admin-bucket}}",
    "arn:aws:lambda:{{region}}:{{accountno}}:function:{{doctor-bucket}}",
    "arn:aws:lambda:{{region}}:{{accountno}}:function:{{appointment-bucket}}"
]
}

Create buildspec.yml, add content and push to repository

Create CodePipeline

Create AWS CodePipeline for CICD process AWS CodePipeline

Deploy API Gateway stage

We can create 4 stages for Dev, QA, UAT, Prod

API Gateway

Check API using Postman or Curl

Postman

Response Postman

Test Result Postman

curl {{Invoke-URL}} Ex: curl https://dv5rqng9s0.execute-api.us-east-2.amazonaws.com/Development/admins

You can add Postman collection Postman Collection

Add API key : x-api-key(Q2gZ5ArllY8bWlqSzA0eS6JmxMibVYUU8kgca1RU)

Thank You!

About

Clinic API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published