arlyxiao / best-practice

1 stars 0 forks source link

serverless steps #106

Open arlyxiao opened 1 year ago

arlyxiao commented 1 year ago

Prepare

Install AWS Cli on windows https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

Configure AWS credential

You should already have AWS account key and secret

aws configure

Follow the example step by step

https://sst.dev/examples/how-to-create-a-websocket-api-with-serverless.html

Deploy

npx sst deploy

Remove

npx sst remove
aws dynamodb delete-table --table-name xx-xxx-xxx

Check dynamoDB online

npx sst console

Test websocket online

https://www.piesocket.com/websocket-tester

Remember to set authorization

$ wscat -c wss://abcdef123.execute-api.us-west-2.amazonaws.com/production -H "authorization:Bearer jwt-from-auth"