API Gateway explorer
apigateway/explorer/
Click from a failing API to the call that broke, and the Lambda run behind it¶
explore() turns a notebook cell into a window on your APIs. The failing ones come first; click one for its routes as a tree and its calls one by one, each with where its time went and, when it reached Lambda, that run's own lines.
- One install, ipywidgets already on SageMaker
- Read-only: never sends a request to an API
- REST, HTTP and WebSocket APIs
- The Lambda run behind a call
The examples use acme's orders-api, a REST API whose POST /orders runs the orders-etl Lambda function, which sometimes takes longer than API Gateway's 29 seconds. For reports you run from code, see the API Gateway guide.

explore(): from an API to its routes, then to a failed call, where its time went and the Lambda run that timed out.
Watch it run¶
Three steps in a notebook, from every API to a call that timed out and the run behind it: each command typed and run, and the window it shows, with what to notice. It plays as you scroll to it; click it to pause, or pick a chapter to jump to a step.
Full screen · Download as MP4, for Slack or a slide (light or dark, as this page is)
Open it¶
-
Install it in a notebook cell:
%pip install aws-analyzer -
Open the window. It uses the notebook's IAM role and region, so there's nothing to configure.
from aws_analyzer import APIGatewayView apigw = APIGatewayView() x = apigw.explore() # the API failing most, or the first
Straight to an API, a stage or a tab
apigw.explore() # the API failing most, or the first
apigw.explore("orders-api", tab="calls") # straight to its calls
apigw.explore("orders-api/dev", since="7d") # another stage, the last 7 days
An API is named by its name, its ID, "name/stage" or its invoke URL. tab= is one of "overview", "routes", "calls", "performance" and "stages", and since= one of "1h", "24h" (the default) and "7d". region=, profile= and height= work as for the reports. The window needs ipywidgets, which SageMaker notebooks already have; without it, or outside Jupyter, explore() shows the reports instead.
Start here¶
Four things to try in your first minute. Nothing you click sends a request to an API or changes it.
What's wrong
- Which APIs are failing? Read the APIs tab, failing ones first
- Who can call a route without signing in? Click the Open routes chip
One API
- Where does a request to this route go? Routes, then click the route
- Why did this call fail? Calls, the 5xx chip, then click it
Every API¶
The APIs tab lists every API in the region, the failing ones first, under the region's findings.

apigw.explore(): every API, the failing ones first; search them, pick a chip (Failing, Open routes, Unused, ...) or click a column to sort.
Each line has its requests, its share of 5xx, its p95 latency, its cost and how it's authorized. Search by name, click a chip for only the Failing, REST, HTTP or WebSocket ones, those with Open routes (anyone can call them) or the Unused ones, and click a column's header to sort by it. Click an API to open it: the cards over the tabs say how it's doing, and the stage menu at the top switches stage.
Its routes¶
The Routes tab is the API's paths as a tree. Click a route for where a request goes, box by box, with the step that fails marked.
The Routes tab is a tree of the API's paths. Click a route to see where a request goes, from the caller through the authorizer to the integration, with the step that fails marked, its settings and the command that calls it.

POST /orders in the Routes tab: the integration is where it fails.
Its calls, one by one¶
The Calls tab is the stage's access log, a call per line. Click one for where its time went, and the Lambda run behind it.
The Calls tab reads the stage's access log for the time picked: a timeline of calls with the failed ones in red, chips by status, and a search box (typing filters what's read; Enter asks CloudWatch Logs for the text over the whole time). Click a call to see where its time went, and for one that reached Lambda, that run's lines.
- The time range is the last hour, 24 hours or 7 days.
- The chips show only the 5xx, 4xx, Slow, Throttled or OK calls.
- A call's page splits its time between the authorizer, the integration and API Gateway itself, and for one that reached Lambda, reads that run by the request ID the log line records.

A call that timed out: API Gateway gave up at 29 seconds, and the orders-etl run behind it finished at 41.
Worth knowing
The Calls tab reads the stage's access log, and API Gateway writes one only when it's turned on: a stage without one has no calls to show, and its note gives the aws apigateway update-stage command that turns it on (see Troubleshooting). Calls after that show up.
Overview, performance and stages¶
The other tabs are the API Gateway guide's reports, a click away.
- Overview is
api_info(): how the API is doing, what needs attention, its stages and its routes. - Performance is
performance(): how long calls take, route by route, against the 29 s limit. - Stages is
stages(): each stage's settings, its throttling and its access log format.
That's the guide. Everything below is reference for when you need it: how the window reads, and every command.
From code¶
The window is an object you can drive: what a click does, a command does too.
x = apigw.explore()
x.open("orders-api", tab="calls") # another API, on a tab
x.route("POST /orders") # a route in the Routes tab
x.call("c4f1…") # a call by its request ID, in the Calls tab
x.refresh() # read everything again (the ↻ button)
How the window reads
AWS is read off the notebook's event loop, so a click returns at once: the APIs and their CloudWatch numbers first, then the one you pick with its routes and stages, then its access log. A call's Lambda run is read when you click it, by the Lambda request ID its access log line records, through the Lambda module. Pick another API while one is still being read and the first one's result is dropped when it comes back.
Command reference¶
| Command | What it does |
|---|---|
explore(api=None, tab=None, stage=None, since="24h", region=None, profile=None, height=None) |
Opens the window and returns it; apigw.explore(...) on an APIGatewayView takes the same |
x.open(api, tab=None) |
Shows another API (a name, ID, "name/stage" or invoke URL), on tab when one is named |
x.route(key) |
Opens a route in the Routes tab ("POST /orders") |
x.call(request_id) |
Opens a call in the Calls tab: where its time went and the Lambda run behind it |
x.refresh() |
Reads everything again (the ↻ button) |