-
Notifications
You must be signed in to change notification settings - Fork 0
Creating AWS API Gateway
Hovhannes Apinyan edited this page Apr 5, 2024
·
1 revision
- Navigate to the AWS Management Console in your web browser.
- Open the AWS API Gateway service by either searching for "API Gateway" in the search bar or locating it in the services list.
- Once in the API Gateway dashboard, click on the
Create APIbutton to initiate the process.
- In the
Create APIinterface, choose theHTTP APIoption. HTTP APIs are designed for low-latency, cost-effective integrations with AWS services, including AWS Lambda and HTTP endpoints. - Click the
Buildbutton to proceed.
- In the
Configure Integrationssection, click onAdd Integration. - Select
Lambdaas the integration type. This choice allows your API to connect and interact with an AWS Lambda function. - From the list, choose the Lambda function you have previously created and wish to use with this API.
- After selecting the Lambda function, proceed by entering a name for your API in the
API namefield and clickNext.
- In the
Configure routessection, set theMethodtoGET. This HTTP method specifies the type of operation your API will perform. - In the
Resource pathfield, enter/getData. This path is the endpoint at which your API will be accessible. - Verify the
Integration targetto ensure that the correct Lambda function is specified. If everything is correct, clickNext.
- In the
Stageconfiguration, you can leave theStage nameas$default. This is a predefined stage provided by AWS, which represents the initial deployment stage of your API. - Click
Nextto continue.
- You will be presented with a review page summarizing the settings and configurations of your API. Carefully check all the details to ensure they are correct and meet your requirements.
- If all information is accurate, click on the
Createbutton to finalize the creation of your HTTP API.
After successfully creating your API, you will be redirected to the main page of your API in the AWS API Gateway console. To find the Invoke URL, follow these steps:
- On the left side of the screen, you will see a navigation pane. Look for a section labeled with your API name, formatted as
API: MyApiName (myapiid). Click on this section to access the settings and details of your API. - Inside your API's dashboard, locate the
Invoke URLsection. This URL represents the entry point for your API and is the base URL to which you will append your resource paths (like/getData) to access different functions of your API. - The
Invoke URLwill be something likehttps://myapiid.execute-api.region.amazonaws.com. To construct the full URL for accessing a specific resource like/getData, append the resource path to the Invoke URL, resulting inhttps://myapiid.execute-api.region.amazonaws.com/getData.
Upon completion, AWS will deploy your HTTP API, making it accessible at the specified resource path. You can then test the API to ensure it interacts correctly with your Lambda function, facilitating the intended data retrieval or processing operations.