

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# CloudFormation 指定 AWS::Serverless::HttpApi 時產生的資源
<a name="sam-specification-generated-resources-httpapi"></a>

指定 `AWS::Serverless::HttpApi` 時， AWS Serverless Application Model (AWS SAM) 會產生`AWS::ApiGatewayV2::Api`基本 CloudFormation 資源。

**`AWS::ApiGatewayV2::Api`**  
*`LogicalId`: *`<httpapi‑LogicalId>`  
*可參考屬性：*N/A （您必須使用 `LogicalId`來參考此 CloudFormation 資源）

除了此 CloudFormation 資源之外，`AWS::Serverless::HttpApi`指定 時， AWS SAM 也會為下列案例產生 CloudFormation 資源：

**Topics**
+ [已指定 StageName 屬性](#sam-specification-generated-resources-httpapi-stage-name)
+ [*未*指定 StageName 屬性](#sam-specification-generated-resources-httpapi-not-stage-name)
+ [已指定 DomainName 屬性](#sam-specification-generated-resources-httpapi-domain-name)

## 已指定 StageName 屬性
<a name="sam-specification-generated-resources-httpapi-stage-name"></a>

`AWS::Serverless::HttpApi` 指定 的 `StageName` 屬性時， AWS SAM 會產生 `AWS::ApiGatewayV2::Stage` CloudFormation 資源。

**`AWS::ApiGatewayV2::Stage`**  
*`LogicalId`: *`<httpapi‑LogicalId><stage‑name>Stage`  
`<stage‑name>` 是 `StageName` 屬性設定為 的字串。例如，如果您將 `StageName`設定為 `Gamma`，則 `LogicalId`為：*MyHttpApiGamma* Stage。  
*可參考屬性： *`<httpapi‑LogicalId>.Stage`

## *未*指定 StageName 屬性
<a name="sam-specification-generated-resources-httpapi-not-stage-name"></a>

`AWS::Serverless::HttpApi` *未*指定 的 `StageName` 屬性時， AWS SAM 會產生 `AWS::ApiGatewayV2::Stage` CloudFormation 資源。

**`AWS::ApiGatewayV2::Stage`**  
*`LogicalId`: *`<httpapi‑LogicalId>ApiGatewayDefaultStage`  
*可參考屬性： *`<httpapi‑LogicalId>.Stage`

## 已指定 DomainName 屬性
<a name="sam-specification-generated-resources-httpapi-domain-name"></a>

`AWS::Serverless::HttpApi` 指定 `DomainName`的 `Domain` 屬性時， AWS SAM 會產生 `AWS::ApiGatewayV2::DomainName` CloudFormation 資源。

**`AWS::ApiGatewayV2::DomainName`**  
*`LogicalId`: *`ApiGatewayDomainNameV2<sha>`  
`<sha>` 是建立堆疊時產生的唯一雜湊值。例如，`ApiGatewayDomainNameV2`*926eeb5ff1*。  
*可參考屬性： *`<httpapi‑LogicalId>.DomainName`