Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS APIGateway: How do I get my API URL using AWS CLI?

I'm running a script using AWS CLI to define and deploy an AWS API Gateway. I'm able to get my API id as well as the deployment id with commands like this:

API_ID=$(aws apigateway get-rest-apis --query "items[?name=='my-api'].id" --output text)
DEPLOYMENT_ID=$(aws apigateway get-stage --rest-api-id $API_ID --stage-name dev --query "deploymentId" --output text)

Now, given that I have my API id and my deployment id, how do I get the API URL, i.e. the information appearing in the API Gateway console when you navigate to API->my-api->stages->dev ?

Many thanks in advance.

Seymour

like image 216
Seymour Glass Avatar asked Oct 28 '25 14:10

Seymour Glass


1 Answers

Simple solution is https://$API_ID.execute-api.$AWS_REGION.amazonaws.com/$STAGE_NAME

like image 153
Seymour Glass Avatar answered Oct 30 '25 11:10

Seymour Glass



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!