{"id":13625039,"url":"https://github.com/damoresa/aws-secure-websockets","last_synced_at":"2025-04-16T06:31:34.950Z","repository":{"id":39867843,"uuid":"200002892","full_name":"damoresa/aws-secure-websockets","owner":"damoresa","description":"Secure web socket implementation using AWS products and serverless framework","archived":false,"fork":false,"pushed_at":"2023-05-06T10:36:52.000Z","size":435,"stargazers_count":52,"open_issues_count":13,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T22:03:36.306Z","etag":null,"topics":["aws","aws-apigateway","aws-cognito","aws-dynamodb","aws-lambda","aws-lambda-node","jwt","medium","nodejs","secure","serverless","serverless-framework","websocket"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damoresa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-08-01T07:44:55.000Z","updated_at":"2024-05-06T10:40:35.000Z","dependencies_parsed_at":"2023-01-24T00:15:22.643Z","dependency_job_id":"ccea896c-9143-4b5d-8b5e-9f6b983e873d","html_url":"https://github.com/damoresa/aws-secure-websockets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoresa%2Faws-secure-websockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoresa%2Faws-secure-websockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoresa%2Faws-secure-websockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damoresa%2Faws-secure-websockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damoresa","download_url":"https://codeload.github.com/damoresa/aws-secure-websockets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223700195,"owners_count":17188265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-apigateway","aws-cognito","aws-dynamodb","aws-lambda","aws-lambda-node","jwt","medium","nodejs","secure","serverless","serverless-framework","websocket"],"created_at":"2024-08-01T21:01:50.152Z","updated_at":"2024-11-08T14:30:17.994Z","avatar_url":"https://github.com/damoresa.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"## AWS Secure Websocket\n\nSecured _web socket_ deployed on _AWS_ infrastructure using \nthe [serverless] framework.\n\nThis repository serves as an example for this \n[medium article]. Please, invest a few minutes reading it \nin case you need further detail.\n\nAll services have been implemented using [NodeJS].\n\n### Serverless service user policies\n\n_serverless_ documentation recommends creating a service user \nwith restricted permissions in order to avoid security issues; \nfor example, user leaking and having admin rights could be \ndevastating for your _AWS_ bill.\n\nHowever, the policies provided on the official example do not \nprovide access to _AWS Cognito_. In order to use proper \npermissions, check the _sls-policies.json_ file within this \nrepository.\n\n### Infrastructure\n\nThe required _AWS_ infrastructure is as follows:\n\n* _Lambda_: used to host our services.\n* _API Gateway_: used to expose our services to the outer \nworld. Also provides authentication using _AWS Cognito_ \ngenerated _JWT_ tokens.\n* _API WebSocket_: used to expose our services as _near \nrealtime connections_, allowing _bi directional_ communication.\nIt also helps us secure our connections using _AWS \nCognito_ generated _JWT_ tokens.\n* _DynamoDB_: used to track active _web socket_ connections \nand what they're subscribed to.\n* _Cognito_: user pool which allows us create and validate \nuser credentials.\n\n### Deploying it\n\nFirst of all, you need an _AWS_ account. Then it is \nmandatory to [configure serverless locally] with your \ncredentials.\n\nOnce you've set your environment up, you can deploy the \nentire stack using the following command:\n```bash\nserverless deploy -v\n```\n\nIn case you want to deploy an specific _lambda_, you can \nuse this other command:\n```bash\nserverless deploy function -f \u003cfunctionName\u003e -v\n```\n\nYou can also remove all the allocated resources by executing \nthis command:\n```bash\nserverless remove -v\n```\n\n[medium article]: https://medium.com/@damoresac/implementing-secure-web-sockets-with-aws-api-gateway-cognito-dynamodb-and-lambda-b38e02314b42\n[NodeJS]: https://nodejs.org/\n[serverless]: https://serverless.com/\n[configure serverless locally]: https://serverless.com/framework/docs/providers/aws/guide/credentials/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamoresa%2Faws-secure-websockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamoresa%2Faws-secure-websockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamoresa%2Faws-secure-websockets/lists"}