Skip to content

Instantly share code, notes, and snippets.

@metaskills
Created March 2, 2023 01:20
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/45a5f09bb097fdd7ae7c8c8f5805236a to your computer and use it in GitHub Desktop.
Save metaskills/45a5f09bb097fdd7ae7c8c8f5805236a to your computer and use it in GitHub Desktop.
WS:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: MyappWebsocketStaging
ProtocolType: WEBSOCKET
RouteSelectionExpression: "$request.body.message"
WebsocketDeployment:
Type: AWS::ApiGatewayV2::Deployment
DependsOn:
- ConnectWSRoute
- DefaultWSRoute
- DisconnectWSRoute
Properties:
ApiId:
Ref: WS
WebsocketStage:
Type: AWS::ApiGatewayV2::Stage
Properties:
StageName: staging
DeploymentId:
Ref: WebsocketDeployment
ApiId:
Ref: WS
WebSocketPolicy:
Type: AWS::IAM::Policy
DependsOn: Role
Properties:
PolicyName: ArcWebSocketPolicy
PolicyDocument:
Statement:
- Effect: Allow
Action:
- execute-api:Invoke
- execute-api:ManageConnections
Resource:
- Fn::Sub:
- arn:aws:execute-api:${AWS::Region}:*:${api}/*
- api:
Ref: WS
Roles:
- Ref: Role
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment