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
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
resource "aws_apigatewayv2_route_response" "publish" {
api_id = var.api_id
route_id = aws_apigatewayv2_route.publish.id
route_response_key = "$default"
}
resource "aws_apigatewayv2_route_response" "send" {
api_id = var.api_id
route_id = aws_apigatewayv2_route.send.id
route_response_key = "$default"
}
resource "aws_apigatewayv2_route_response" "hello" {
api_id = var.api_id
route_id = aws_apigatewayv2_route.connect.id
route_response_key = "$default"
}
resource "aws_apigatewayv2_route_response" "bye" {
api_id = var.api_id
route_id = aws_apigatewayv2_route.disconnect.id
route_response_key = "$default"
}
Parameters
-
api_id
required - string -
id
optional computed - string -
model_selection_expression
optional - string -
response_models
optional - map from string to string -
route_id
required - string -
route_response_key
required - string
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
-
RouteResponseKey
required - String -
ResponseParameters
optional - Json -
RouteId
required - String -
ModelSelectionExpression
optional - String -
ApiId
required - String -
ResponseModels
optional - Json
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.