AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::ApiGatewayV2::Route

CfnRoute

The `AWS::ApiGatewayV2::Route` resource creates a route for an API.

Import

import { CfnRoute } from 'aws-cdk-lib/aws-apigatewayv2';

Or use the module namespace:

import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
// apigatewayv2.CfnRoute

Properties

Configuration passed to the constructor as CfnRouteProps.

apiIdRequired
string | IApiRef

The API identifier.

routeKeyRequired
string

The route key for the route. For HTTP APIs, the route key can be either `$default` , or a combination of an HTTP method and resource path, for example, `GET /pets` .

apiKeyRequiredOptional
boolean | IResolvable

Specifies whether an API key is required for the route. Supported only for WebSocket APIs.

authorizationScopesOptional
string[]

The authorization scopes supported by this route.

authorizationTypeOptional
string

The authorization type for the route. For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer.

authorizerIdOptional
string | IAuthorizerRef

The identifier of the `Authorizer` resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.

modelSelectionExpressionOptional
string

The model selection expression for the route. Supported only for WebSocket APIs.

operationNameOptional
string

The operation name for the route.

requestModelsOptional
any

The request models for the route. Supported only for WebSocket APIs.

requestParametersOptional
any

The request parameters for the route. Supported only for WebSocket APIs.

routeResponseSelectionExpressionOptional
string

The route response selection expression for the route. Supported only for WebSocket APIs.

targetOptional
string | IIntegrationRef

The target for the route.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter