Skip to content

Commit e4db500

Browse files
committed
Update and fix docs
1 parent 8c54ec5 commit e4db500

File tree

1 file changed

+65
-42
lines changed

1 file changed

+65
-42
lines changed

docs/providers/aws/events/apigateway.md

Lines changed: 65 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,45 @@ layout: Doc
1212

1313
# API Gateway
1414

15-
- [API Gateway](#API-Gateway)
16-
- [Lambda Proxy Integration](#Lambda-Proxy-Integration)
17-
- [Simple HTTP Endpoint](#Simple-HTTP-Endpoint)
18-
- [Example "LAMBDA-PROXY" event (default)](#Example-%22LAMBDA-PROXY%22-event-default)
19-
- [HTTP Endpoint with Extended Options](#HTTP-Endpoint-with-Extended-Options)
20-
- [Enabling CORS](#Enabling-CORS)
21-
- [HTTP Endpoints with `AWS_IAM` Authorizers](#HTTP-Endpoints-with-AWSIAM-Authorizers)
22-
- [HTTP Endpoints with Custom Authorizers](#HTTP-Endpoints-with-Custom-Authorizers)
23-
- [Using asynchronous integration](#Using-asynchronous-integration)
24-
- [Catching Exceptions In Your Lambda Function](#Catching-Exceptions-In-Your-Lambda-Function)
25-
- [Setting API keys for your Rest API](#Setting-API-keys-for-your-Rest-API)
26-
- [Configuring endpoint types](#Configuring-endpoint-types)
27-
- [Request Parameters](#Request-Parameters)
28-
- [Request Schema Validators](#Request-Schema-Validators)
29-
- [Setting source of API key for metering requests](#Setting-source-of-API-key-for-metering-requests)
30-
- [Lambda Integration](#Lambda-Integration)
31-
- [Example "LAMBDA" event (before customization)](#Example-%22LAMBDA%22-event-before-customization)
32-
- [Request templates](#Request-templates)
33-
- [Default Request Templates](#Default-Request-Templates)
34-
- [Custom Request Templates](#Custom-Request-Templates)
35-
- [Pass Through Behavior](#Pass-Through-Behavior)
36-
- [Responses](#Responses)
37-
- [Custom Response Headers](#Custom-Response-Headers)
38-
- [Custom Response Templates](#Custom-Response-Templates)
39-
- [Status Codes](#Status-Codes)
40-
- [Available Status Codes](#Available-Status-Codes)
41-
- [Using Status Codes](#Using-Status-Codes)
42-
- [Custom Status Codes](#Custom-Status-Codes)
43-
- [Setting an HTTP Proxy on API Gateway](#Setting-an-HTTP-Proxy-on-API-Gateway)
44-
- [Share API Gateway and API Resources](#Share-API-Gateway-and-API-Resources)
45-
- [Easiest and CI/CD friendly example of using shared API Gateway and API Resources.](#Easiest-and-CICD-friendly-example-of-using-shared-API-Gateway-and-API-Resources)
46-
- [Manually Configuring shared API Gateway](#Manually-Configuring-shared-API-Gateway)
47-
- [Note while using authorizers with shared API Gateway](#Note-while-using-authorizers-with-shared-API-Gateway)
48-
- [Share Authorizer](#Share-Authorizer)
49-
- [Resource Policy](#Resource-Policy)
50-
- [Compression](#Compression)
51-
- [Binary Media Types](#Binary-Media-Types)
52-
- [AWS X-Ray Tracing](#AWS-X-Ray-Tracing)
53-
- [Tags / Stack Tags](#Tags--Stack-Tags)
54-
- [Logs](#Logs)
15+
- [API Gateway](#api-gateway)
16+
- [Lambda Proxy Integration](#lambda-proxy-integration)
17+
- [Simple HTTP Endpoint](#simple-http-endpoint)
18+
- [Example "LAMBDA-PROXY" event (default)](#example-lambda-proxy-event-default)
19+
- [HTTP Endpoint with Extended Options](#http-endpoint-with-extended-options)
20+
- [Enabling CORS](#enabling-cors)
21+
- [HTTP Endpoints with `AWS_IAM` Authorizers](#http-endpoints-with-aws_iam-authorizers)
22+
- [HTTP Endpoints with Custom Authorizers](#http-endpoints-with-custom-authorizers)
23+
- [Catching Exceptions In Your Lambda Function](#catching-exceptions-in-your-lambda-function)
24+
- [Setting API keys for your Rest API](#setting-api-keys-for-your-rest-api)
25+
- [Configuring endpoint types](#configuring-endpoint-types)
26+
- [Request Parameters](#request-parameters)
27+
- [Request Schema Validation](#request-schema-validation)
28+
- [Setting source of API key for metering requests](#setting-source-of-api-key-for-metering-requests)
29+
- [Lambda Integration](#lambda-integration)
30+
- [Example "LAMBDA" event (before customization)](#example-lambda-event-before-customization)
31+
- [Request templates](#request-templates)
32+
- [Default Request Templates](#default-request-templates)
33+
- [Custom Request Templates](#custom-request-templates)
34+
- [Pass Through Behavior](#pass-through-behavior)
35+
- [Responses](#responses)
36+
- [Custom Response Headers](#custom-response-headers)
37+
- [Custom Response Templates](#custom-response-templates)
38+
- [Status Codes](#status-codes)
39+
- [Available Status Codes](#available-status-codes)
40+
- [Using Status Codes](#using-status-codes)
41+
- [Custom Status Codes](#custom-status-codes)
42+
- [Setting an HTTP Proxy on API Gateway](#setting-an-http-proxy-on-api-gateway)
43+
- [Share API Gateway and API Resources](#share-api-gateway-and-api-resources)
44+
- [Easiest and CI/CD friendly example of using shared API Gateway and API Resources.](#easiest-and-cicd-friendly-example-of-using-shared-api-gateway-and-api-resources)
45+
- [Manually Configuring shared API Gateway](#manually-configuring-shared-api-gateway)
46+
- [Note while using authorizers with shared API Gateway](#note-while-using-authorizers-with-shared-api-gateway)
47+
- [Share Authorizer](#share-authorizer)
48+
- [Resource Policy](#resource-policy)
49+
- [Compression](#compression)
50+
- [Binary Media Types](#binary-media-types)
51+
- [AWS X-Ray Tracing](#aws-x-ray-tracing)
52+
- [Tags / Stack Tags](#tags--stack-tags)
53+
- [Logs](#logs)
5554

5655
_Are you looking for tutorials on using API Gateway? Check out the following resources:_
5756

@@ -1104,6 +1103,7 @@ provider:
11041103
apiGateway:
11051104
restApiId: xxxxxxxxxx # REST API resource ID. Default is generated by the framework
11061105
restApiRootResourceId: xxxxxxxxxx # Root resource, represent as / path
1106+
websocketApiId: xxxxxxxxxx # Websocket API resource ID. Default is generated by the framewok
11071107
description: Some Description # optional - description of deployment history
11081108
11091109
functions:
@@ -1120,6 +1120,7 @@ provider:
11201120
apiGateway:
11211121
restApiId: xxxxxxxxxx
11221122
restApiRootResourceId: xxxxxxxxxx
1123+
websocketApiId: xxxxxxxxxx
11231124
description: Some Description
11241125
11251126
functions:
@@ -1137,6 +1138,7 @@ provider:
11371138
apiGateway:
11381139
restApiId: xxxxxxxxxx
11391140
restApiRootResourceId: xxxxxxxxxx
1141+
websocketApiId: xxxxxxxxxx
11401142
description: Some Description
11411143
11421144
functions:
@@ -1156,6 +1158,7 @@ provider:
11561158
apiGateway:
11571159
restApiId: xxxxxxxxxx
11581160
restApiRootResourceId: xxxxxxxxxx
1161+
websocketApiId: xxxxxxxxxx
11591162
description: Some Description
11601163
restApiResources:
11611164
posts: xxxxxxxxxx
@@ -1171,6 +1174,7 @@ provider:
11711174
apiGateway:
11721175
restApiId: xxxxxxxxxx
11731176
restApiRootResourceId: xxxxxxxxxx
1177+
websocketApiId: xxxxxxxxxx
11741178
description: Some Description
11751179
restApiResources:
11761180
/posts: xxxxxxxxxx
@@ -1189,6 +1193,7 @@ provider:
11891193
apiGateway:
11901194
restApiId: xxxxxxxxxx
11911195
# restApiRootResourceId: xxxxxxxxxx # Optional
1196+
websocketApiId: xxxxxxxxxx
11921197
description: Some Description
11931198
restApiResources:
11941199
/posts: xxxxxxxxxx
@@ -1214,7 +1219,7 @@ functions:
12141219

12151220
### Easiest and CI/CD friendly example of using shared API Gateway and API Resources.
12161221

1217-
You can define your API Gateway resource in its own service and export the `restApiId` and `restApiRootResourceId` using cloudformation cross-stack references.
1222+
You can define your API Gateway resource in its own service and export the `restApiId`, `restApiRootResourceId` and `websocketApiId` using cloudformation cross-stack references.
12181223

12191224
```yml
12201225
service: my-api
@@ -1232,6 +1237,13 @@ resources:
12321237
Properties:
12331238
Name: MyApiGW
12341239
1240+
MyWebsocketApi:
1241+
Type: AWS::ApiGatewayV2::Api
1242+
Properties:
1243+
Name: MyWebsocketApi
1244+
ProtocolType: WEBSOCKET
1245+
RouteSelectionExpression: '$request.body.action'
1246+
12351247
Outputs:
12361248
apiGatewayRestApiId:
12371249
Value:
@@ -1246,9 +1258,16 @@ resources:
12461258
- RootResourceId
12471259
Export:
12481260
Name: MyApiGateway-rootResourceId
1261+
1262+
websocketApiId:
1263+
Value:
1264+
Ref: MyWebsocketApi
1265+
Export:
1266+
Name: MyApiGateway-websocketApiId
1267+
12491268
```
12501269

1251-
This creates API gateway and then exports the `restApiId` and `rootResourceId` values using cloudformation cross stack output.
1270+
This creates API gateway and then exports the `restApiId`, `rootResourceId` and `websocketApiId` values using cloudformation cross stack output.
12521271
We will import this and reference in future services.
12531272

12541273
```yml
@@ -1260,6 +1279,8 @@ provider:
12601279
'Fn::ImportValue': MyApiGateway-restApiId
12611280
restApiRootResourceId:
12621281
'Fn::ImportValue': MyApiGateway-rootResourceId
1282+
websocketApiId:
1283+
'Fn::ImportValue': MyApiGateway-websocketApiId
12631284
12641285
functions:
12651286
service-a-functions
@@ -1273,6 +1294,8 @@ provider:
12731294
'Fn::ImportValue': MyApiGateway-restApiId
12741295
restApiRootResourceId:
12751296
'Fn::ImportValue': MyApiGateway-rootResourceId
1297+
websocketApiId:
1298+
'Fn::ImportValue': MyApiGateway-websocketApiId
12761299
12771300
functions:
12781301
service-b-functions

0 commit comments

Comments
 (0)