There are two primary methods to obtain the URL of an API in AWS API Gateway:
In either of these, you must first log into the AWS Management Console and navigate to the API Gateway service, and locate and select the API you wish to get the URL for.
Using the Deploy API Action
Using the "Deploy API" action from the "Actions" menu is a quick way to deploy your API and obtain the URL for a specific stage in API Gateway. To do so, on the API Overview page (which is visible after you select your API from API Gateway console), you can do the following:
- Find and click on the "Actions" button, and select "Deploy API" from the menu;
- In the "Deploy API" dialog box, you will be prompted to choose the deployment stage (e.g. "
dev
", "test
", "prod
", etc.) — if you don't see the desired stage you wish to deploy to, then you can always create a new one; - After selecting your desired stage, click on the "Deploy" button to proceed with the deployment of the API;
- Once the deployment is successful, you will see a confirmation message, and the API Gateway console will display the "Invoke URL" for the deployed stage.
"Invoke URL" represents the base URL and path to the endpoint. If you have defined resource paths for your API, you can append them to the base URL to access specific API endpoints.
Using the Stages Option
You can navigate to the "Stages" page by selecting the "Stages" option from the left-hand panel. This will show you the different environments or versions of your API (such as "dev
", "test
", "prod
", etc.), where you can find the URL for a specific stage.
Once you're on the Stages page, you can do the following to obtain the URL for your selected API:
- Select the appropriate stage/environment for the API you want to get the URL for;
- Once you have selected the stage, you will see the stage details displayed in the main section of the page, where you can look for "Invoke URL".
"Invoke URL" represents the base URL and path to the endpoint. If you have defined resource paths for your API, you can append them to the base URL to access specific API endpoints.
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.