AWS CloudFormation
User Guide (Version )

AWS::ApiGatewayV2::RouteResponse

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.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::ApiGatewayV2::RouteResponse", "Properties" : { "ApiId" : String, "ModelSelectionExpression" : String, "ResponseModels" : Json, "ResponseParameters" : Json, "RouteId" : String, "RouteResponseKey" : String } }

YAML

Type: AWS::ApiGatewayV2::RouteResponse Properties: ApiId: String ModelSelectionExpression: String ResponseModels: Json ResponseParameters: Json RouteId: String RouteResponseKey: String

Properties

ApiId

The API identifier.

Required: Yes

Type: String

Update requires: Replacement

ModelSelectionExpression

The model selection expression for the route response.

Required: No

Type: String

Update requires: No interruption

ResponseModels

The response models for the route response.

Required: No

Type: Json

Update requires: No interruption

ResponseParameters

The route response parameters.

Required: No

Type: Json

Update requires: No interruption

RouteId

The route ID.

Required: Yes

Type: String

Update requires: Replacement

RouteResponseKey

The route response key.

Required: Yes

Type: String

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Route Response resource ID, such as abc123.

For more information about using the Ref function, see Ref.

Examples

Route response creation example

The following example creates a RouteResponse resource for a WebSocket API called MyApi that already has an integration called MyIntegration and a route called MyRoute.

JSON

{ "MyRouteResponse": { "Type": "AWS::ApiGatewayV2::RouteResponse", "Properties": { "RouteId": { "Ref": "MyRoute" }, "ApiId": { "Ref": "MyApi" }, "RouteResponseKey": "$default" } } }

YAML

MyRouteResponse: Type: 'AWS::ApiGatewayV2::RouteResponse' Properties: RouteId: !Ref MyRoute ApiId: !Ref MyApi RouteResponseKey: $default

See Also