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.jsof new lambda -
Create a new DynamoDB table
SOME_TABLEfor storing connection ids of active clients connected to WebSocket -
Add
TABLE: SOME_TABLEto 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
Stagesand select a stage, copy the WebSocket URL -
Paste the url as
ENDPOINTvariable inindex.jsof WebSocket Lambda, paste it inmain.pyof GCS and also inwsSendfunction of Alexa's Lambda -
Deploy the lambda function
None




