AWS::ApiGatewayV2::RouteResponse - AWS CloudFormation

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" : ParameterConstraints, "RouteId" : String, "RouteResponseKey" : String } }

YAML

Type: AWS::ApiGatewayV2::RouteResponse Properties: ApiId: String ModelSelectionExpression: String ResponseModels: Json ResponseParameters: ParameterConstraints 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. Supported only for WebSocket APIs.

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: ParameterConstraints

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.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

RouteResponseId

The route response ID.

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