In this section, we create a WebSocket server using API Gateway's endpoint and lambda as backend to create a persistent medium of low-latency communication between the Alexa skill lambda and GCS
-
Create a new lambda function with
Node.js 16.x
, paste this inindex.js
of new lambda -
Create a new DynamoDB table
SOME_TABLE
for storing connection ids of active clients connected to WebSocket -
Add
TABLE: SOME_TABLE
to environment variables of lambda function -
Create a new WebSocket API in AWS API Gateway, configure it according to below images
-
After creating and deploying WebSocket API, navigate to
Stages
and select a stage, copy the WebSocket URL -
Paste the url as
ENDPOINT
variable inindex.js
of WebSocket Lambda, paste it inmain.py
of GCS and also inwsSend
function of Alexa's Lambda -
Deploy the lambda function
None