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.
Follow the following steps to add an API to amazon API gateway.
- Navigate to ‘API Gateway’ in aws console.
- Click on the type of API you want to create
3. Select API (REST or Websocket)
Also give name and description
4. From the window click on Resources (left panel)
5. Click on the dropdown “Actions”
a. Select the option “create resource”
i. Fill in the Fields Resource Name and Resource Path and click on create resource.
- Then you can see a new resource has been added to the pane.
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
iii. Select the method and click the tick ‘✅’ next to it.
iv. You can see a setup box for the chosen method.
- Integration type as HTTP
- Method as the resource method we trying to add from the drop down
- Fill in the Endpoint URL with appropriate end point
vi. And then click save
6. Again click on Actions drop down and select “Enable CORS”
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.
* there will be a pop up to confirm the same.
If all went ok it will look like this:
Now that we have added the new API resource we need to update the current changes to our actual API endpoint, for that.
- Once again click on “Actions” drop down and select ‘Deploy API’.
- From the pop up dialog box provide the Stage name description and Deployment description .
Now your new API will be added and available via the endpoint.
To update an existing API endpoint or add new API endpoint to the gateway follow :
- Navigate to Resources tab from the left pane.
- Select the method that to be updated from under the respective resource.
- Select Integration Request and update the Endpoint URL and select the tick ‘✅’ next to it.
- We can see the endpoint has been updated .
- 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’.
- From the pop up update the details and select the stage then click on Deploy.
Now the changes will be updated to the selected stage.
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.