Skip to main content

routes

Creates, updates, deletes or gets a route resource or lists routes in a region

Overview

Nameroutes
TypeResource
DescriptionThe AWS::ApiGatewayV2::Route resource creates a route for an API.
Idaws.apigatewayv2.routes

Fields

NameDatatypeDescription
route_idstring
route_response_selection_expressionstringThe route response selection expression for the route. Supported only for WebSocket APIs.
request_modelsobjectThe request models for the route. Supported only for WebSocket APIs.
operation_namestringThe operation name for the route.
authorization_scopesarrayThe authorization scopes supported by this route.
api_key_requiredbooleanSpecifies whether an API key is required for the route. Supported only for WebSocket APIs.
route_keystringThe 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.
authorization_typestringThe 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.
model_selection_expressionstringThe model selection expression for the route. Supported only for WebSocket APIs.
api_idstringThe API identifier.
request_parametersobjectThe request parameters for the route. Supported only for WebSocket APIs.
targetstringThe target for the route.
authorizer_idstringThe identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTRouteKey, ApiId, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all routes in a region.

SELECT
region,
route_id,
route_response_selection_expression,
request_models,
operation_name,
authorization_scopes,
api_key_required,
route_key,
authorization_type,
model_selection_expression,
api_id,
request_parameters,
target,
authorizer_id
FROM aws.apigatewayv2.routes
WHERE region = 'us-east-1';

Gets all properties from an individual route.

SELECT
region,
route_id,
route_response_selection_expression,
request_models,
operation_name,
authorization_scopes,
api_key_required,
route_key,
authorization_type,
model_selection_expression,
api_id,
request_parameters,
target,
authorizer_id
FROM aws.apigatewayv2.routes
WHERE region = 'us-east-1' AND data__Identifier = '<ApiId>|<RouteId>';

INSERT example

Use the following StackQL query and manifest file to create a new route resource, using stack-deploy.

/*+ create */
INSERT INTO aws.apigatewayv2.routes (
RouteKey,
ApiId,
region
)
SELECT
'{{ RouteKey }}',
'{{ ApiId }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.apigatewayv2.routes
WHERE data__Identifier = '<ApiId|RouteId>'
AND region = 'us-east-1';

Permissions

To operate on the routes resource, the following permissions are required:

Create

apigateway:POST

Update

apigateway:PATCH,
apigateway:GET,
apigateway:PUT

Read

apigateway:GET

Delete

apigateway:GET,
apigateway:DELETE

List

apigateway:GET