Table: aws_api_gatewayv2_stage - Query AWS API Gateway Stages using SQL
The AWS API Gateway Stage is a crucial component within the AWS API Gateway service. It represents a phase in the lifecycle of an API (like development, production, or beta) that an application developer interacts with. Stages are accompanied by a stage name, deployment identifier, and a description, and they allow for the routing of incoming API calls to various backend endpoints.
Table Usage Guide
The aws_api_gatewayv2_stage
table in Steampipe provides you with information about stages within AWS API Gateway. This table allows you, as a DevOps engineer, to query stage-specific details, including default route settings, deployment ID, description, and associated metadata. You can utilize this table to gather insights on stages, such as the last updated time of the stage, stage variables, auto deployment details, and more. The schema outlines for you the various attributes of the API Gateway stage, including the stage name, API ID, created date, and associated tags.
Examples
List of API gateway V2 stages which does not send logs to cloud watch log
Identify instances where API Gateway stages are not configured to send logs to Cloud Watch, which could help in troubleshooting and analyzing API performance.
select stage_name, api_id, default_route_data_trace_enabledfrom aws_api_gatewayv2_stagewhere not default_route_data_trace_enabled;
select stage_name, api_id, default_route_data_trace_enabledfrom aws_api_gatewayv2_stagewhere default_route_data_trace_enabled = 0;
Default route settings info of each API gateway V2 stage
Explore the default settings of each stage in your API gateway to understand how data tracing, detailed metrics, and throttling limits are configured. This helps in managing your API effectively by fine-tuning these settings as per your requirements.
select stage_name, api_id, default_route_data_trace_enabled, default_route_detailed_metrics_enabled, default_route_throttling_burst_limit, default_route_throttling_rate_limitfrom aws_api_gatewayv2_stage;
select stage_name, api_id, default_route_data_trace_enabled, default_route_detailed_metrics_enabled, default_route_throttling_burst_limit, default_route_throttling_rate_limitfrom aws_api_gatewayv2_stage;
Count of API gateway V2 stages by APIs
Determine the quantity of stages each API Gateway has, which can be useful for understanding the complexity and scale of each individual API.
select api_id, count(stage_name) stage_countfrom aws_api_gatewayv2_stagegroup by api_id;
select api_id, count(stage_name) as stage_countfrom aws_api_gatewayv2_stagegroup by api_id;
Get access log settings of API gateway V2 stages
Discover the configuration settings of different stages in API gateway V2 to better understand and manage access logs and data tracing. This can be useful for enhancing security and troubleshooting issues.
select stage_name, api_id, default_route_data_trace_enabled, jsonb_pretty(access_log_settings) as access_log_settingsfrom aws_api_gatewayv2_stage;
select stage_name, api_id, default_route_data_trace_enabled, access_log_settingsfrom aws_api_gatewayv2_stage;
Query examples
Control examples
- Access logging should be configured for API Gateway V2 Stages
- API Gateway stage logging should be enabled
- AWS Foundational Security Best Practices > API Gateway > 1 API Gateway REST and WebSocket API logging should be enabled
- AWS Foundational Security Best Practices > API Gateway > 9 Access logging should be configured for API Gateway V2 Stages
Schema for aws_api_gatewayv2_stage
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
access_log_settings | jsonb | Access log settings of the stage. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
api_gateway_managed | boolean | Specifies whether a stage is managed by API Gateway | |
api_id | text | = | The id of the api which contains this stage |
auto_deploy | boolean | Specifies whether updates to an API automatically trigger a new deployment | |
client_certificate_id | text | The identifier of a client certificate for a Stage. Supported only for WebSocket APIs | |
created_date | text | The timestamp when the stage was created | |
default_route_data_trace_enabled | boolean | Specifies whether (true) or not (false) data trace logging is enabled for this route. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs | |
default_route_detailed_metrics_enabled | boolean | Specifies whether detailed metrics are enabled | |
default_route_logging_level | text | Specifies the logging level for this route: INFO, ERROR, or OFF. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs | |
default_route_throttling_burst_limit | bigint | Throttling burst limit for default route settings | |
default_route_throttling_rate_limit | double precision | Throttling rate limit for default route settings | |
deployment_id | text | The identifier of the Deployment that the Stage is associated with | |
description | text | The stage's description | |
last_deployment_status_message | text | Describes the status of the last deployment of a stage. Supported only for stages with autoDeploy enabled | |
last_updated_date | text | The timestamp when the stage was last updated | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
region | text | The AWS Region in which the resource is located. | |
route_settings | jsonb | Route settings for the stage, by routeKey. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
stage_name | text | = | The name of the stage |
stage_variables | jsonb | A map that defines the stage variables for a stage resource | |
tags | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_api_gatewayv2_stage