Amazon CloudFormation resources generated when AWS::Serverless::WebSocketApi is specified
When an AWS::Serverless::WebSocketApi is specified, Amazon Serverless Application Model (Amazon SAM) generates an AWS::ApiGatewayV2::Api base Amazon CloudFormation resource. In addition, it also always generates an AWS::ApiGatewayV2::Stage resource, and for each route defined in the Routes property, Amazon SAM generates AWS::ApiGatewayV2::Route, AWS::ApiGatewayV2::Integration, and AWS::Lambda::Permission resources.
AWS::ApiGatewayV2::Api-
LogicalId:<websocketapi‑LogicalId>Referenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource) AWS::ApiGatewayV2::Stage-
LogicalId:<websocketapi‑LogicalId><stage‑name>Stageis the string that the<stage‑name>StageNameproperty is set to. IfStageNameis not specified, the default value isdefault. For example, if you setStageNametoprod, theLogicalIdis.MyWebSocketApiprodStageReferenceable property:
<websocketapi‑LogicalId>.Stage AWS::ApiGatewayV2::Route-
LogicalId:<websocketapi‑LogicalId><normalized‑route‑key>Routeis the route key with special characters removed. For example, for route key<normalized‑route‑key>$connect, theLogicalIdis.MyWebSocketApiconnectRouteReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource) AWS::ApiGatewayV2::Integration-
LogicalId:<websocketapi‑LogicalId><normalized‑route‑key>IntegrationReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource) AWS::Lambda::Permission-
LogicalId:<websocketapi‑LogicalId><normalized‑route‑key>PermissionReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource)
In addition to these Amazon CloudFormation resources, when AWS::Serverless::WebSocketApi is specified, Amazon SAM also generates Amazon CloudFormation resources for the following scenarios:
Scenarios
Auth property is specified with AuthType set to CUSTOM
When the Auth property of an AWS::Serverless::WebSocketApi is specified with AuthType set to CUSTOM, Amazon SAM generates an AWS::ApiGatewayV2::Authorizer Amazon CloudFormation resource. If InvokeRole is not specified, Amazon SAM also generates an AWS::Lambda::Permission resource to allow API Gateway to invoke the authorizer function.
AWS::ApiGatewayV2::Authorizer-
LogicalId:<websocketapi‑LogicalId>AuthorizerReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource) AWS::Lambda::Permission(whenInvokeRoleis not specified)-
LogicalId:<websocketapi‑LogicalId>AuthorizerPermissionReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource)
DomainName property is specified
When the DomainName property of the Domain property of an AWS::Serverless::WebSocketApi is specified, Amazon SAM generates the AWS::ApiGatewayV2::DomainName Amazon CloudFormation resource.
AWS::ApiGatewayV2::DomainName-
LogicalId:ApiGatewayDomainNameV2<sha>is a unique hash value that is generated when the stack is created. For example:<sha>ApiGatewayDomainNameV2.926eeb5ff1Referenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource)
BasePath property is specified
When the BasePath property of the Domain property of an AWS::Serverless::WebSocketApi is specified, Amazon SAM generates AWS::ApiGatewayV2::ApiMapping Amazon CloudFormation resources, one for each base path specified.
AWS::ApiGatewayV2::ApiMapping-
LogicalId:<websocketapi‑LogicalId><basepath>ApiMappingis the base path value. For example, if you specify<basepath>v1as a base path, theLogicalIdis.MyWebSocketApiv1ApiMappingReferenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource)
Route53 property is specified
When the Route53 property of the Domain property of an AWS::Serverless::WebSocketApi is specified, Amazon SAM generates an AWS::Route53::RecordSetGroup Amazon CloudFormation resource.
AWS::Route53::RecordSetGroup-
LogicalId:RecordSetGroup<sha>is a unique hash value that is generated when the stack is created. For example:<sha>RecordSetGroup.926eeb5ff1Referenceable property: N/A (you must use the
LogicalIdto reference this Amazon CloudFormation resource)