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

base.tf#L20
resource "aws_apigatewayv2_stage" "prod" {
  api_id = aws_apigatewayv2_api.api.id
  name = "prod"

  auto_deploy = true

gateway_stage.tf#L1
resource "aws_apigatewayv2_stage" "_" {
  name        = var.stage_name
  api_id      = aws_apigatewayv2_api._.id
  description = "Default Stage"
  auto_deploy = true

aws_api_gateway_stage_logging.tf#L11
resource "aws_apigatewayv2_stage" "allowed" {
  access_log_settings {
  }
}

resource "aws_apigatewayv2_stage" "denied" {
api_gateway.tf#L6
resource "aws_apigatewayv2_stage" "lambda_stage" {
    api_id      = aws_apigatewayv2_api.lambda_api.id
    name        = "$default"
    auto_deploy = true
}

api-gateway.tf#L6
resource "aws_apigatewayv2_stage" "this" {
  api_id = aws_apigatewayv2_api.this.id
  name   = "$default"
  auto_deploy = true
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

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

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.