View a markdown version of this page

Amazon CloudFormation resources generated when AWS::Serverless::WebSocketApi is specified - Amazon Serverless Application Model
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 LogicalId to reference this Amazon CloudFormation resource)

AWS::ApiGatewayV2::Stage

LogicalId: <websocketapi‑LogicalId><stage‑name>Stage

<stage‑name> is the string that the StageName property is set to. If StageName is not specified, the default value is default. For example, if you set StageName to prod, the LogicalId is MyWebSocketApiprodStage.

Referenceable property: <websocketapi‑LogicalId>.Stage

AWS::ApiGatewayV2::Route

LogicalId: <websocketapi‑LogicalId><normalized‑route‑key>Route

<normalized‑route‑key> is the route key with special characters removed. For example, for route key $connect, the LogicalId is MyWebSocketApiconnectRoute.

Referenceable property: N/A (you must use the LogicalId to reference this Amazon CloudFormation resource)

AWS::ApiGatewayV2::Integration

LogicalId: <websocketapi‑LogicalId><normalized‑route‑key>Integration

Referenceable property: N/A (you must use the LogicalId to reference this Amazon CloudFormation resource)

AWS::Lambda::Permission

LogicalId: <websocketapi‑LogicalId><normalized‑route‑key>Permission

Referenceable property: N/A (you must use the LogicalId to 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:

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>Authorizer

Referenceable property: N/A (you must use the LogicalId to reference this Amazon CloudFormation resource)

AWS::Lambda::Permission (when InvokeRole is not specified)

LogicalId: <websocketapi‑LogicalId>AuthorizerPermission

Referenceable property: N/A (you must use the LogicalId to 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>

<sha> is a unique hash value that is generated when the stack is created. For example: ApiGatewayDomainNameV2926eeb5ff1.

Referenceable property: N/A (you must use the LogicalId to 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>ApiMapping

<basepath> is the base path value. For example, if you specify v1 as a base path, the LogicalId is MyWebSocketApiv1ApiMapping.

Referenceable property: N/A (you must use the LogicalId to 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>

<sha> is a unique hash value that is generated when the stack is created. For example: RecordSetGroup926eeb5ff1.

Referenceable property: N/A (you must use the LogicalId to reference this Amazon CloudFormation resource)