Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created March 2, 2023 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaskills/6862c2f878800d3e6b32dd72ef4e2717 to your computer and use it in GitHub Desktop.
Save metaskills/6862c2f878800d3e6b32dd72ef4e2717 to your computer and use it in GitHub Desktop.
DisconnectWSLambda:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
CodeUri: "/var/task/src/ws/disconnect"
Runtime: nodejs16.x
Architectures:
- x86_64
MemorySize: 1152
DisconnectWSRoute:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId:
Ref: WS
RouteKey: "$disconnect"
OperationName: DisconnectWSRoute
Target:
Fn::Join:
- "/"
- - integrations
- Ref: DisconnectWSIntegration
DisconnectWSIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId:
Ref: WS
IntegrationType: AWS_PROXY
IntegrationUri:
Fn::Sub:
- arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${DisconnectWSLambda.Arn}/invocations
- {}
DisconnectWSPermission:
Type: AWS::Lambda::Permission
DependsOn:
- WS
- DisconnectWSLambda
Properties:
Action: lambda:InvokeFunction
FunctionName:
Ref: DisconnectWSLambda
Principal: apigateway.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment