AWS API Gateway V2 Route Response

This page shows how to write Terraform and CloudFormation for API Gateway V2 Route Response and write them securely.

aws_apigatewayv2_route_response (Terraform)

The Route Response in API Gateway V2 can be configured in Terraform with the resource name aws_apigatewayv2_route_response. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "aws_apigatewayv2_route_response" "this" {
  api_id                     = var.api_id
  model_selection_expression = var.model_selection_expression
  response_models            = var.response_models
  route_id                   = var.route_id
  route_response_key         = var.route_response_key
response.tf#L7
resource "aws_apigatewayv2_route_response" "publish" {
  api_id             = var.api_id
  route_id           = aws_apigatewayv2_route.publish.id
  route_response_key = "$default"
}
response.tf#L7
resource "aws_apigatewayv2_route_response" "send" {
  api_id             = var.api_id
  route_id           = aws_apigatewayv2_route.send.id
  route_response_key = "$default"
}
response.tf#L7
resource "aws_apigatewayv2_route_response" "hello" {
  api_id             = var.api_id
  route_id           = aws_apigatewayv2_route.connect.id
  route_response_key = "$default"
}
response.tf#L7
resource "aws_apigatewayv2_route_response" "bye" {
  api_id             = var.api_id
  route_id           = aws_apigatewayv2_route.disconnect.id
  route_response_key = "$default"
}

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 route response. More information can be found in the Amazon API Gateway Developer Guide.

AWS::ApiGatewayV2::RouteResponse (CloudFormation)

The RouteResponse in ApiGatewayV2 can be configured in CloudFormation with the resource name AWS::ApiGatewayV2::RouteResponse. 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::RouteResponse resource creates a route response for a WebSocket API. For more information, see Set up Route Responses for a WebSocket API in API Gateway in the API Gateway Developer Guide.

Frequently asked questions

What is AWS API Gateway V2 Route Response?

AWS API Gateway V2 Route Response 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 Route Response?

For Terraform, the niveklabs/aws, obytes/terraform-aws-sumu and obytes/terraform-aws-sumu source code examples are useful. See the Terraform Example section for further details.