Created
January 12, 2022 09:27
-
-
Save velotiotech/8db20fd14858e21fd2ab54c52306ca56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: ssh-qrapp-websocket | |
frameworkVersion: '2' | |
useDotenv: true | |
provider: | |
name: aws | |
runtime: nodejs12.x | |
lambdaHashingVersion: 20201221 | |
websocketsApiName: ssh-qrapp-websocket | |
websocketsApiRouteSelectionExpression: $request.body.action | |
region: ap-south-1 | |
iam: | |
role: | |
statements: | |
- Effect: Allow | |
Action: | |
- "dynamodb:query" | |
- "dynamodb:GetItem" | |
- "dynamodb:PutItem" | |
Resource: | |
- Fn::GetAtt: [ SSHAuthDB, Arn ] | |
environment: | |
REGION: ${env:REGION} | |
DYNAMODB_TABLE: SSHAuthDB | |
WEBSOCKET_ENDPOINT: ${env:WEBSOCKET_ENDPOINT} | |
NODE_ENV: ${env:NODE_ENV} | |
package: | |
patterns: | |
- '!node_modules/**' | |
- handler.js | |
- '!package.json' | |
- '!package-lock.json' | |
plugins: | |
- serverless-dotenv-plugin | |
layers: | |
sshQRAPPLibs: | |
path: layer | |
compatibleRuntimes: | |
- nodejs12.x | |
functions: | |
connectionHandler: | |
handler: handler.connectHandler | |
timeout: 60 | |
memorySize: 256 | |
layers: | |
- {Ref: SshQRAPPLibsLambdaLayer} | |
events: | |
- websocket: | |
route: $connect | |
routeResponseSelectionExpression: $default | |
disconnectHandler: | |
handler: handler.disconnectHandler | |
memorySize: 256 | |
timeout: 60 | |
layers: | |
- {Ref: SshQRAPPLibsLambdaLayer} | |
events: | |
- websocket: $disconnect | |
defaultHandler: | |
handler: handler.defaultHandler | |
memorySize: 256 | |
timeout: 60 | |
layers: | |
- {Ref: SshQRAPPLibsLambdaLayer} | |
events: | |
- websocket: $default | |
customQueryHandler: | |
handler: handler.queryHandler | |
memorySize: 256 | |
timeout: 60 | |
layers: | |
- {Ref: SshQRAPPLibsLambdaLayer} | |
events: | |
- websocket: | |
route: expectauth | |
routeResponseSelectionExpression: $default | |
- websocket: | |
route: getconid | |
routeResponseSelectionExpression: $default | |
- websocket: | |
route: verifyauth | |
routeResponseSelectionExpression: $default | |
resources: | |
Resources: | |
SSHAuthDB: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
TableName: ${env:DYNAMODB_TABLE} | |
AttributeDefinitions: | |
- AttributeName: authkey | |
AttributeType: S | |
KeySchema: | |
- AttributeName: authkey | |
KeyType: HASH | |
TimeToLiveSpecification: | |
AttributeName: expires_at | |
Enabled: true | |
ProvisionedThroughput: | |
ReadCapacityUnits: 2 | |
WriteCapacityUnits: 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment