Amazon Web Services (AWS) - List your API Gateway REST APIs using the AWS CLI

by
Jeremy Canfield |
Updated: December 09 2023
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
The aws apigateway get-rest-apis command can be used to list your API Gateway REST APIs.
]$ aws apigateway get-rest-apis
{
"items": [
{
"apiKeySource": "HEADER",
"name": "sam-app",
"tags": {
"aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-1:123456789012:stack/sam-app/0882e400-842b-11ee-9053-0e798d5724d7",
"aws:cloudformation:stack-name": "sam-app",
"aws:cloudformation:logical-id": "ServerlessRestApi"
},
"endpointConfiguration": {
"types": [
"EDGE"
]
},
"version": "1.0",
"createdDate": 1700103122,
"id": "abcdefg123"
}
]
}
And then the aws apigateway get-resources command can be used to list your API Gateway Resources using the id returned in the prior command.
]$ aws apigateway get-resources --rest-api-id abcdefg123
{
"items": [
{
"path": "/api",
"id": "5fzp03",
"pathPart": "api",
"parentId": "wxhgpi1kz5"
},
{
"path": "/api/sendgrid",
"id": "c02nnh",
"pathPart": "sendgrid",
"parentId": "5fzp03"
},
{
"path": "/api/sendgrid/v1",
"resourceMethods": {
"POST": {}
},
"id": "cn5emi",
"pathPart": "v1",
"parentId": "c02nnh"
},
{
"path": "/",
"id": "wxhgpi1kz5"
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at