Config API Gateway

Update Lambda function

  1. Open AWS Lambda console.
  2. Select upload_document function.
  3. Comment on line 13 and uncomment line 12.
  4. Click Deploy

UpdateFunction

Config API Gateway

  1. Open Amazon API Gateway console

ConfigAPI

  1. Click Create API

ConfigAPI

  1. Scroll down to REST API section, click Build

ConfigAPI

  1. Leave the default REST for the protocol.
  • Select New API
  • Enter API name: fcj-dms-api
  • Select Endpoint type as Regional
  • Click Create API

ConfigAPI

  1. After creating the API, click Action | Create Resource to create resource for API.

ConfigAPI

  1. Enter resource name: docs, then click Create Resource

ConfigAPI

  1. Select docs resource, then click Action | Create Method

ConfigAPI

  1. Click POST method và and click the symbol

ConfigAPI

  1. Set up the method as follows:
  • Keep default Integration type as Lambda Function
  • Check Use Lambda Proxy integration
  • Select the region of the Lambda function you created
  • Select upload_document function
  • Finally press Save

ConfigAPI

  1. Click OK

ConfigAPI

  1. After created GET method, click Action | Create Resource to create next resource.

ConfigAPI

  1. Enter resource name: id and resource path as {id}, then click Create Resource

ConfigAPI

  1. Select {id} resource, then click Action | Create Method

ConfigAPI

  1. Select GET method and click the symbol

ConfigAPI

  1. Set up the method as follows:
  • Keep default Integration type as Lambda Function
  • Check Use Lambda Proxy integration
  • Select the region of the Lambda function you created
  • Select list_documents function
  • Finally press Save

ConfigAPI

  1. Click OK

ConfigAPI

  1. Click Action | Create Method to create a new method

ConfigAPI

  1. Select DELETE method and click the symbol

ConfigAPI

  1. Set up the method as follows:
  • Keep default Integration type as Lambda Function
  • Check Use Lambda Proxy integration
  • Select the region of the Lambda function you created
  • Select delete_documents function
  • Finally press Save

ConfigAPI

  1. Click OK

ConfigAPI

  1. Select DELETE method, then select Method Request

ConfigAPI

  1. Expand URL Query String Parameters section, click Add query string to add a new parameter

ConfigAPI

  1. Enter parameter name: file and click the symbol. This parameter is value of of the name of the file you want to delete.

ConfigAPI

  1. Select docs resource, then click Actions | Enable CORS

ConfigAPI

  1. Click Enable CORS and replace existing CORS headers

ConfigAPI

  1. Click Yes, replace existing values

ConfigAPI

  1. Do the same to enable CORS for {id} resource
  • Select {id} resource, then click Actions | Enable CORS

ConfigAPI

  • Click Enable CORS and replace existing CORS headers

ConfigAPI

  • Click Yes, replace existing values

ConfigAPI

  1. After completing the setup, we deploy the API. Select /docs, then click Actions | Deploy API

ConfigAPI

  1. Select [New Stage]
  • Enter stage name: dev
  • Click Deploy

ConfigAPI

  1. Note down the URL of the API used for the next section.

ConfigAPI

  1. Expand the stage, select the POST method and write down the URL.

ConfigAPI

  1. Select the DELETE method and write down the URL.

ConfigAPI

You have finished setting up the API. Next, we will test the API working and integrate it into our application.