

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# の生成済み CloudFormation リソース AWS SAM
<a name="sam-specification-generated-resources"></a>

このセクションでは、 が AWS テンプレート AWS SAM を処理するときに作成される CloudFormation リソースについて詳しく説明します。が AWS SAM 生成する CloudFormation リソースのセットは、指定したシナリオによって異なります。*シナリオ*とは、テンプレートファイルで指定される AWS SAM リソースとプロパティの組み合わせのことです。テンプレートファイル内の他の部分で生成された CloudFormation リソースは、テンプレートファイルで明示的に宣言するリファレンスの参照方法と同じように参照できます。

例えば、 AWS SAM テンプレートファイルで `AWS::Serverless::Function` リソースを指定すると、 AWS SAM は常に `AWS::Lambda::Function` ベースのリソースを生成します。オプションの `AutoPublishAlias`プロパティも指定すると、 は AWS SAM さらに `AWS::Lambda::Alias`および `AWS::Lambda::Version`リソースを生成します。

このセクションでは、シナリオとそれらが生成する CloudFormation リソースを一覧表示し、 AWS SAM テンプレートファイルで生成された CloudFormation リソースを参照する方法を示します。

## 生成された CloudFormation リソースの参照
<a name="sam-specification-generated-resources-referencing"></a>

 AWS SAM テンプレートファイル内で生成された CloudFormation リソースを参照するには、 `LogicalId`または参照可能なプロパティの 2 つのオプションがあります。

### LogicalId による生成された CloudFormation リソースの参照
<a name="sam-specification-generated-resources-referencing-logicalid"></a>

が AWS SAM 生成する各 CloudFormation リソースには`[LogicalId](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html#resources-section-structure-logicalid)`、テンプレートファイル内で一意の英数字 (A～Z、a～z、0～9) 識別子である があります。 は、テンプレートファイル内の AWS SAM リソース`LogicalIds`の AWS SAM を使用して、生成する CloudFormation リソース`LogicalIds`の を構築します。生成された CloudFormation リソース`LogicalId`の を使用して、明示的に宣言した リソースの場合と同様に CloudFormation 、テンプレートファイル内のそのリソースのプロパティにアクセスできます。 CloudFormation および AWS SAM テンプレート`LogicalIds`の詳細については、「 *AWS CloudFormation ユーザーガイド*」の[「 リソース](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html)」を参照してください。

**注記**  
生成されたリソースの `LogicalIds` には、名前空間の衝突を避けるための一意のハッシュ値が含まれるものがあります。これらのリソースの `LogicalIds` は、スタックの作成時に導出されます。スタックが作成された後にのみ AWS マネジメントコンソール、 AWS CLI、またはいずれかの AWS SDKs を使用して取得できます。ハッシュ値が変更される可能性があるため、`LogicalId` によるこれらのリソースの参照は推奨されません。

### 参照可能なプロパティによる生成された CloudFormation リソースの参照
<a name="sam-specification-generated-resources-referencing-referenceable-property"></a>

一部の生成されたリソースについて、 はリソースの AWS SAM 参照可能なプロパティ AWS SAM を提供します。このプロパティを使用して、生成された CloudFormation リソースとそのプロパティを AWS SAM テンプレートファイル内で参照できます。

**注記**  
生成されたすべての CloudFormation リソースに参照可能なプロパティがあるわけではありません。これらのリソースには、`LogicalId` を使用する必要があります。

## 生成された CloudFormation リソースシナリオ
<a name="sam-specification-generated-resources-scenarios"></a>

次の表は、 AWS SAM リソースを生成するシナリオを構成する CloudFormation リソースとプロパティをまとめたものです。**シナリオ**列のトピックには、そのシナリオで が AWS SAM 生成する追加の CloudFormation リソースに関する詳細が記載されています。


| AWS SAM リソース | 基本 CloudFormation リソース | シナリオ | 
| --- | --- | --- | 
| AWS::Serverless::Api  | [AWS::ApiGateway::RestApi](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html) |  +  [DomainName プロパティが指定されている](sam-specification-generated-resources-api.md#sam-specification-generated-resources-api-domain-name) <br />+  [UsagePlan プロパティが指定されている](sam-specification-generated-resources-api.md#sam-specification-generated-resources-api-usage-plan)   | 
| AWS::Serverless::Application  | [AWS::CloudFormation::Stack](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html) |  +  ベース CloudFormation リソースを生成する以外に、このサーバーレスリソースには追加のシナリオはありません。   | 
| AWS::Serverless::CapacityProvider  | [AWS::Lambda::CapacityProvider](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-capacityprovider.html) |  +  [OperatorRole プロパティが指定されていません](sam-specification-generated-resources-capacityprovider.md#sam-specification-generated-resources-capacityprovider-iam-role)   | 
| AWS::Serverless::MicrovmImage  | [AWS::Lambda::MicrovmImage](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-microvmimage.html) |  +  [BuildRoleArn プロパティが指定されていません](sam-specification-generated-resources-microvmimage.md#sam-specification-generated-resources-microvmimage-iam-role)   | 
| AWS::Serverless::NetworkConnector  | [AWS::Lambda::NetworkConnector](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-networkconnector.html) |  +  [OperatorRole プロパティが指定されていません](sam-specification-generated-resources-networkconnector.md#sam-specification-generated-resources-networkconnector-iam-role)   | 
| AWS::Serverless::Function | [AWS::Lambda::Function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) |  +  [AutoPublishAlias プロパティが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-autopublishalias) <br />+  [Role プロパティが指定されていない](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-not-role) <br />+  [DeploymentPreference プロパティが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-deploymentpreference) <br />+  [Api イベントソースが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-api) <br />+  [HttpApi イベントソースが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-httpapi) <br />+  [ストリーミングイベントソースが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-streaming) <br />+  [イベントブリッジ (またはイベントバス) イベントソースが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-eventbridge) <br />+  [IotRule イベントソースが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-iotrule) <br />+  [Amazon SNS イベントに対して OnSuccess (または OnFailure) プロパティが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-sns-onsuccess) <br />+  [Amazon SQS イベントに対して OnSuccess (または OnFailure) プロパティが指定されている](sam-specification-generated-resources-function.md#sam-specification-generated-resources-function-sqs-onsuccess)   | 
| AWS::Serverless::HttpApi | [AWS::ApiGatewayV2::Api](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html) |  +  [StageName プロパティが指定されている](sam-specification-generated-resources-httpapi.md#sam-specification-generated-resources-httpapi-stage-name) <br />+  [StageName プロパティが指定されて*いない*](sam-specification-generated-resources-httpapi.md#sam-specification-generated-resources-httpapi-not-stage-name) <br />+  [DomainName プロパティが指定されている](sam-specification-generated-resources-httpapi.md#sam-specification-generated-resources-httpapi-domain-name)   | 
| AWS::Serverless::LayerVersion  | [AWS::Lambda::LayerVersion](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversion.html) |  +  ベース CloudFormation リソースを生成する以外に、このサーバーレスリソースには追加のシナリオはありません。   | 
| AWS::Serverless::SimpleTable  | [AWS::DynamoDB::Table](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html) |  +  ベース CloudFormation リソースを生成する以外に、このサーバーレスリソースには追加のシナリオはありません。   | 
| AWS::Serverless::StateMachine  | [AWS::StepFunctions::StateMachine](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html) |  +  [Role プロパティが指定されていない](sam-specification-generated-resources-statemachine.md#sam-specification-generated-resources-statemachine-not-role) <br />+  [Api イベントソースが指定されている](sam-specification-generated-resources-statemachine.md#sam-specification-generated-resources-statemachine-api) <br />+  [イベントブリッジ (またはイベントバス) イベントソースが指定されている](sam-specification-generated-resources-statemachine.md#sam-specification-generated-resources-statemachine-eventbridge)   | 

**Topics**
+ [生成された CloudFormation リソースの参照](#sam-specification-generated-resources-referencing)
+ [生成された CloudFormation リソースシナリオ](#sam-specification-generated-resources-scenarios)
+ [CloudFormation AWS::Serverless::Apiが指定されているときに生成される リソース](sam-specification-generated-resources-api.md)
+ [CloudFormation AWS::Serverless::Applicationが指定されているときに生成される リソース](sam-specification-generated-resources-application.md)
+ [CloudFormation AWS::Serverless::CapacityProviderが指定されているときに生成される リソース](sam-specification-generated-resources-capacityprovider.md)
+ [CloudFormation を指定したときに生成される リソース AWS::Serverless::Connector](sam-specification-generated-resources-connector.md)
+ [CloudFormation AWS::Serverless::Functionが指定されているときに生成される リソース](sam-specification-generated-resources-function.md)
+ [CloudFormation AWS::Serverless::GraphQLApiが指定されているときに生成される リソース](sam-specification-generated-resources-graphqlapi.md)
+ [CloudFormation AWS::Serverless::HttpApi を指定したときに生成される リソース](sam-specification-generated-resources-httpapi.md)
+ [CloudFormation AWS::Serverless::MicrovmImageが指定されているときに生成される リソース](sam-specification-generated-resources-microvmimage.md)
+ [CloudFormation AWS::Serverless::NetworkConnectorが指定されているときに生成される リソース](sam-specification-generated-resources-networkconnector.md)
+ [CloudFormation AWS::Serverless::WebSocketApi が指定されているときに生成される リソース](sam-specification-generated-resources-websocketapi.md)
+ [CloudFormation AWS::Serverless::LayerVersionが指定されているときに生成される リソース](sam-specification-generated-resources-layerversion.md)
+ [CloudFormation AWS::Serverless::SimpleTableが指定されているときに生成される リソース](sam-specification-generated-resources-simpletable.md)
+ [CloudFormation AWS::Serverless::StateMachineが指定されているときに生成される リソース](sam-specification-generated-resources-statemachine.md)