AWS API Gateway

Amazon’s API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs. API developers can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud.

API creation

Follow the following steps to add an API to amazon API gateway.

  1. Navigate to ‘API Gateway’ in aws console.
  1. Click on the type of API you want to create
how to create an Amazon AWS API

   3. Select API (REST or Websocket)

Also give name and description 

amazon api gateway-choose protocol

  4. From the window click on Resources (left panel)

aws API gateway interface

5. Click on the dropdown “Actions

AWS API Resources

a. Select the option “create resource

i. Fill in the Fields Resource Name and Resource Path and click on create resource.

aws gateway
  • Then you can see a new resource has been added to the pane.
creating an aws API

b. Click on the newly created resource and then once again click on “Actions” drop down as mentioned in step 4.

i. Select the option “Create method” 

Here you can observe a new drop down has been added under the newly created resource.

ii. Click on the method required for the resource from the drop down 

actions dropdown menu

iii. Select the method and click the tick  ‘✅’ next to it.

Eb94AdpzoBKDR44mvIBWaRxGwDizscH5i8XPOtLOi2c1GeC nUe4aHb3LLDdg5NezPsyy43IpjbR 2l1HyUMjxp2pyau8d2n6YYCJh qEDOs2gFrPrt74KIyl1i4Lvw6mVIlInei

iv. You can see a setup box for the chosen method.

GET Setup AWS Setup

v. Choose 

  1. Integration type as HTTP
  2. Method as the resource method we trying to add from the drop down
  3. Fill in the Endpoint URL with appropriate end point 
Integration types aws api

vi. And then click save

GET-Method execution AWS API

6. Again click on Actions drop down and select “Enable CORS

mLltZsRoXlQmKPU2OecGwo0eT21DaUidMXjA7sZTzm6Bxhuczadf0ZmXGy0fGs

7.In the sub menu on the right panel for enabling CORS make necessary changes if needed or leave it for default settings. And click on “Enable CORS and replace existing CORS headers” button.

Enabling CORS-AWS API creation

* there will be a pop up to confirm the same.

If all went ok it will look like this: 

Confirmation popup after enabling CORS-AWS API

Now that we have added the new API resource we need to update the current changes to our actual API endpoint, for that.

  1. Once again click on “Actions” drop down and select ‘Deploy API’.
Deploying the API-AWS API Creation
  1. From the pop up dialog box provide the Stage name description and Deployment description .
Choosing a stage for API Deployment

Now your new API will be added and available via the endpoint.

New AWS API Creation Tutorial

API Updation

To update an existing API endpoint or add new API endpoint to the gateway follow :

  1. Navigate to Resources tab from the left pane.
AWS API Gateway Guide
  1. Select the method that to be updated from under the respective resource.
AWS API-Resources
  1. Select Integration Request and update the Endpoint URL and select the tick  ‘✅’ next to it.
Selecting integration request and updating end point URL-AWS API Creation
  1. We can see the endpoint has been updated .
GET Method Execution-AWS API
  1. Now we need to deploy the changes made to API gateway to reflect the same.

For that from the “Actions” drop down and select ‘Deploy API’.

Deploying API- AWS API Setup guide
  1. From the pop up update the details and select the stage then click on Deploy.
Deploying AWS API-AWS Guide

Now the changes will be updated to the selected stage.

FAQ Section

What is an API ?

API stands for Application Programming Interface.

What is an API used for ?

An API is a software intermediary that allows two applications to communicate each other.

What is AWS?

Amazon webservice is a cloud computing platform or service provided by Amazon.

How to create an AWS API ?

Login to AWS Management Console, select API Gateway under Application Services and Choose create an API.

GET STARTED WITH OUR CLOUD SERVICES

Leave a Reply