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_idrequired - string -
arnoptional computed - string -
auto_deployoptional - bool -
client_certificate_idoptional - string -
deployment_idoptional computed - string -
descriptionoptional - string -
execution_arnoptional computed - string -
idoptional computed - string -
invoke_urloptional computed - string -
namerequired - string -
stage_variablesoptional - map from string to string -
tagsoptional - map from string to string -
access_log_settingslist block-
destination_arnrequired - string -
formatrequired - string
-
-
default_route_settingslist block-
data_trace_enabledoptional - bool -
detailed_metrics_enabledoptional - bool -
logging_leveloptional computed - string -
throttling_burst_limitoptional - number -
throttling_rate_limitoptional - number
-
-
route_settingsset block-
data_trace_enabledoptional - bool -
detailed_metrics_enabledoptional - bool -
logging_leveloptional computed - string -
route_keyrequired - string -
throttling_burst_limitoptional - number -
throttling_rate_limitoptional - 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
-
ClientCertificateIdoptional - String -
DeploymentIdoptional - String -
Descriptionoptional - String -
AccessLogSettingsoptional - AccessLogSettings -
AutoDeployoptional - Boolean -
RouteSettingsoptional - Json -
StageNamerequired - String -
StageVariablesoptional - Json -
AccessPolicyIdoptional - String -
ApiIdrequired - String -
DefaultRouteSettingsoptional - RouteSettings -
Tagsoptional - Json
Explanation in CloudFormation Registry
The
AWS::ApiGatewayV2::Stageresource 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.