AWS API Gateway V2 Stage
This page shows how to write Terraform and CloudFormation for API Gateway V2 Stage and write them securely.
aws_apigatewayv2_stage (Terraform)
The Stage in API Gateway V2 can be configured in Terraform with the resource name aws_apigatewayv2_stage
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_apigatewayv2_stage" "prod" {
api_id = aws_apigatewayv2_api.api.id
name = "prod"
auto_deploy = true
resource "aws_apigatewayv2_stage" "_" {
name = var.stage_name
api_id = aws_apigatewayv2_api._.id
description = "Default Stage"
auto_deploy = true
resource "aws_apigatewayv2_stage" "allowed" {
access_log_settings {
}
}
resource "aws_apigatewayv2_stage" "denied" {
resource "aws_apigatewayv2_stage" "lambda_stage" {
api_id = aws_apigatewayv2_api.lambda_api.id
name = "$default"
auto_deploy = true
}
resource "aws_apigatewayv2_stage" "this" {
api_id = aws_apigatewayv2_api.this.id
name = "$default"
auto_deploy = true
}
Parameters
-
api_id
required - string -
arn
optional computed - string -
auto_deploy
optional - bool -
client_certificate_id
optional - string -
deployment_id
optional computed - string -
description
optional - string -
execution_arn
optional computed - string -
id
optional computed - string -
invoke_url
optional computed - string -
name
required - string -
stage_variables
optional - map from string to string -
tags
optional - map from string to string -
access_log_settings
list block-
destination_arn
required - string -
format
required - string
-
-
default_route_settings
list block-
data_trace_enabled
optional - bool -
detailed_metrics_enabled
optional - bool -
logging_level
optional computed - string -
throttling_burst_limit
optional - number -
throttling_rate_limit
optional - number
-
-
route_settings
set block-
data_trace_enabled
optional - bool -
detailed_metrics_enabled
optional - bool -
logging_level
optional computed - string -
route_key
required - string -
throttling_burst_limit
optional - number -
throttling_rate_limit
optional - number
-
Explanation in Terraform Registry
Manages an Amazon API Gateway Version 2 stage. More information can be found in the Amazon API Gateway Developer Guide.
AWS::ApiGatewayV2::Stage (CloudFormation)
The Stage in ApiGatewayV2 can be configured in CloudFormation with the resource name AWS::ApiGatewayV2::Stage
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
ClientCertificateId
optional - String -
DeploymentId
optional - String -
Description
optional - String -
AccessLogSettings
optional - AccessLogSettings -
AutoDeploy
optional - Boolean -
RouteSettings
optional - Json -
StageName
required - String -
StageVariables
optional - Json -
AccessPolicyId
optional - String -
ApiId
required - String -
DefaultRouteSettings
optional - RouteSettings -
Tags
optional - Json
Explanation in CloudFormation Registry
The
AWS::ApiGatewayV2::Stage
resource specifies a stage for an API. Each stage is a named reference to a deployment of the API and is made available for client applications to call. To learn more, see Working with stages for HTTP APIs and Deploy a WebSocket API in API Gateway.
Frequently asked questions
What is AWS API Gateway V2 Stage?
AWS API Gateway V2 Stage is a resource for API Gateway V2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS API Gateway V2 Stage?
For Terraform, the CIPowell/chrisipowell-be, obytes/terraform-aws-lambda-apigw and snyk-labs/infrastructure-as-code-goof source code examples are useful. See the Terraform Example section for further details.