Created
September 25, 2019 07:37
-
-
Save SumindaD/0ab03a3cca4cf537514d740f57c09724 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: awswebsocketchat | |
| frameworkVersion: "1.48.2" | |
| custom: | |
| currentStage: ${opt:stage, self:provider.stage} | |
| lambdaRunTime: python3.7 | |
| socketConnectionsTableName: socketConnections-#{AWS::AccountId}-${self:custom.currentStage} | |
| provider: | |
| name: aws | |
| iamManagedPolicies: | |
| - arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess | |
| runtime: ${self:custom.lambdaRunTime} | |
| versionFunctions: false | |
| region: eu-west-1 | |
| timeout: 29 | |
| plugins: | |
| - serverless-pseudo-parameters | |
| package: | |
| individually: true | |
| exclude: | |
| - "lib/**" | |
| - "node_modules/**" | |
| layers: | |
| pythonPackageLayer: | |
| path: lib | |
| name: Python-Package-layer | |
| description: Python Package layer | |
| compatibleRuntimes: | |
| - ${self:custom.lambdaRunTime} | |
| functions: | |
| connectHandler: | |
| handler: connect_handler.handle | |
| events: | |
| - websocket: $connect | |
| layers: | |
| - { Ref: PythonPackageLayerLambdaLayer } | |
| environment: | |
| SOCKET_CONNECTIONS_TABLE_NAME: ${self:custom.socketConnectionsTableName} | |
| disconnectHandler: | |
| handler: disconnect_handler.handle | |
| events: | |
| - websocket: $disconnect | |
| layers: | |
| - { Ref: PythonPackageLayerLambdaLayer } | |
| environment: | |
| SOCKET_CONNECTIONS_TABLE_NAME: ${self:custom.socketConnectionsTableName} | |
| onMessageHandler: | |
| handler: on_message_handler.handle | |
| events: | |
| - websocket: | |
| route: onMessage | |
| layers: | |
| - { Ref: PythonPackageLayerLambdaLayer } | |
| environment: | |
| SOCKET_CONNECTIONS_TABLE_NAME: ${self:custom.socketConnectionsTableName} | |
| resources: | |
| Resources: | |
| socketConnectionsTable: | |
| Type: AWS::DynamoDB::Table | |
| DeletionPolicy: Retain | |
| Properties: | |
| TableName: ${self:custom.socketConnectionsTableName} | |
| AttributeDefinitions: | |
| - AttributeName: connectionId | |
| AttributeType: S | |
| KeySchema: | |
| - AttributeName: connectionId | |
| KeyType: HASH | |
| BillingMode: PAY_PER_REQUEST | |
| SSESpecification: | |
| SSEEnabled: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment