

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

# AWS::Serverless::Api
<a name="sam-resource-api"></a>

HTTPS エンドポイント経由で呼び出すことができる Amazon API Gateway リソースとメソッドのコレクションを作成します。

[AWS::Serverless::Api](#sam-resource-api) リソースを AWS サーバーレスアプリケーション定義テンプレートに明示的に追加する必要はありません。このタイプのリソースは、[AWS::Serverless::Function](sam-resource-function.md) リソースを参照しないテンプレートで定義された [AWS::Serverless::Api](#sam-resource-api) リソースに定義される Api イベントの和集合から暗黙的に作成されます。

[AWS::Serverless::Api](#sam-resource-api) リソースは、OpenApi を使用して API を定義および文書化するために使用する必要があります。これは、基盤となる Amazon API Gateway リソースを設定する機能をより多く提供します。

 CloudFormation フックまたは IAM ポリシーを使用して、API Gateway リソースにアクセスを制御するオーソライザーがアタッチされていることを確認することをお勧めします。

 CloudFormation フックの使用の詳細については、*CloudFormation CLI ユーザーガイド*の[「フックの登録](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/registering-hook-python.html)」および[apigw-enforce-authorizer](https://github.com/aws-cloudformation/aws-cloudformation-samples/tree/main/hooks/python-hooks/apigw-enforce-authorizer/) GitHub リポジトリ」を参照してください。

IAM ポリシーの使用の詳細については、「*API ゲートウェイデベロッパーガイド*」の「[API ルートに認可を要求する](https://docs.aws.amazon.com/apigateway/latest/developerguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-require-authorization)」を参照してください。

**注記**  
にデプロイすると AWS CloudFormation、 は AWS SAM リソースを CloudFormation リソース AWS SAM に変換します。詳細については、「[の生成済み CloudFormation リソース AWS SAM](sam-specification-generated-resources.md)」を参照してください。

## 構文
<a name="sam-resource-api-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-resource-api-syntax.yaml"></a>

```
Type: AWS::Serverless::Api
Properties:
  [AccessLogSetting](#sam-api-accesslogsetting): [AccessLogSetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-accesslogsetting)
  AlwaysDeploy: Boolean
  [ApiKeySourceType](#sam-api-apikeysourcetype): String
  [Auth](#sam-api-auth): ApiAuth
  [BinaryMediaTypes](#sam-api-binarymediatypes): List
  [CacheClusterEnabled](#sam-api-cacheclusterenabled): Boolean
  [CacheClusterSize](#sam-api-cacheclustersize): String
  [CanarySetting](#sam-api-canarysetting): [CanarySetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-canarysetting)
  [Cors](#sam-api-cors): String | CorsConfiguration
  [DefinitionBody](#sam-api-definitionbody): JSON
  [DefinitionUri](#sam-api-definitionuri): String | ApiDefinition
  [Description](#sam-api-description): String
  [DisableExecuteApiEndpoint](#sam-api-disableexecuteapiendpoint): Boolean
  [Domain](#sam-api-domain): DomainConfiguration
  [EndpointConfiguration](#sam-api-endpointconfiguration): EndpointConfiguration
  [FailOnWarnings](#sam-api-failonwarnings): Boolean
  [GatewayResponses](#sam-api-gatewayresponses): Map
  MergeDefinitions: Boolean
  [MethodSettings](#sam-api-methodsettings): MethodSettings
  [MinimumCompressionSize](#sam-api-minimumcompressionsize): Integer
  [Mode](#sam-api-mode): String
  [Models](#sam-api-models): Map
  [Name](#sam-api-name): String
  [OpenApiVersion](#sam-api-openapiversion): String
  PropagateTags: Boolean
  [Policy](#sam-api-policy): JSON
  [StageName](#sam-api-stagename): String
  [Tags](#sam-api-tags): Map
  [TracingEnabled](#sam-api-tracingenabled): Boolean
  [Variables](#sam-api-variables): Map
```

## プロパティ
<a name="sam-resource-api-properties"></a>

 `AccessLogSetting`   <a name="sam-api-accesslogsetting"></a>
ステージのアクセスログ設定を行います。  
*タイプ*: [AccessLogSetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-accesslogsetting)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[AccessLogSetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-accesslogsetting)`プロパティに直接渡されます。

 `AlwaysDeploy`   <a name="sam-api-alwaysdeploy"></a>
API への変更が検出されない場合でも、常に API をデプロイします。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ApiKeySourceType`   <a name="sam-api-apikeysourcetype"></a>
使用量プランに沿ってリクエストを計測するための API キーのソース。有効な値は、`HEADER` および `AUTHORIZER` です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[ApiKeySourceType](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-apikeysourcetype)`プロパティに直接渡されます。

 `Auth`   <a name="sam-api-auth"></a>
API Gateway API へのアクセスを制御するための認可を設定します。  
を使用したアクセスの設定の詳細については、 AWS SAM 「」を参照してください[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md)。グローバルオーソライザーを上書きする方法の例については、「[Amazon API Gateway REST API のグローバルオーソライザーをオーバーライドする](sam-property-function-apifunctionauth.md#sam-property-function-apifunctionauth--examples--override)」を参照してください。  
*タイプ*: [ApiAuth](sam-property-api-apiauth.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `BinaryMediaTypes`   <a name="sam-api-binarymediatypes"></a>
API が返すことができる MIME タイプのリストです。これは、API のバイナリサポートを有効化するために使用します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[BinaryMediaTypes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-binarymediatypes)`プロパティに似ています。BinaryMediaTypes のリストが CloudFormation リソースと OpenAPI ドキュメントの両方に追加されます。

 `CacheClusterEnabled`   <a name="sam-api-cacheclusterenabled"></a>
ステージでキャッシュが有効化されているかどうかを示します。レスポンスをキャッシュするには、`MethodSettings` で `CachingEnabled` を `true` に設定することも必要です。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[CacheClusterEnabled](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-cacheclusterenabled)`プロパティに直接渡されます。

 `CacheClusterSize`   <a name="sam-api-cacheclustersize"></a>
ステージのキャッシュクラスターサイズです。  
タイプ：文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[CacheClusterSize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-cacheclustersize)`プロパティに直接渡されます。

 `CanarySetting`   <a name="sam-api-canarysetting"></a>
通常のデプロイの段階に Canary 設定を設定します。  
*タイプ*: [CanarySetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-canarysetting)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[CanarySetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-canarysetting)`プロパティに直接渡されます。

 `Cors`   <a name="sam-api-cors"></a>
すべての API Gateway API のクロスオリジンリソース共有 (CORS) を管理します。許可するドメインを文字列として指定するか、追加の CORS 設定でディクショナリを指定します。  
CORS では AWS SAM 、OpenAPI 定義を変更する必要があります。CORS を有効にするには、`DefinitionBody` の中でインライン OpenAPI 定義を作成します。
CORS の詳細については、*Amazon API Gateway デベロッパーガイド*の「[REST API リソースの CORS を有効にする](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html)」を参照してください。  
*タイプ*: 文字列 \$1 [CorsConfiguration](sam-property-api-corsconfiguration.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `DefinitionBody`   <a name="sam-api-definitionbody"></a>
API を説明する OpenAPI 仕様です。`DefinitionUri` と `DefinitionBody` のどちらも指定されていない場合、SAM はテンプレート設定に基づいて `DefinitionBody` を生成します。  
API を定義するローカルの OpenAPI ファイルを参照するには、`AWS::Include` 変換を使用してください。詳細については[がローカルファイル AWS SAM をアップロードする方法](deploy-upload-local-files.md)を参照してください。  
*Type*: JSON  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[Body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body)`プロパティに似ています。特定のプロパティが提供されている場合、コンテンツは、CloudFormation に渡される前に DefinitionBody に挿入または変更される可能性があります。プロパティには `Auth`、`BinaryMediaTypes`、`Cors`、`GatewayResponses`、`Models`、および、対応する `AWS::Serverless::Function` 向けの `EventSource` タイプの API が含まれます。

 `DefinitionUri`   <a name="sam-api-definitionuri"></a>
Amazon S3 URI、ローカルファイルパス、または API を定義する OpenAPI ドキュメントのロケーションオブジェクトです。このプロパティが参照する Amazon S3 オブジェクトは、有効な OpenAPI ファイルである必要があります。`DefinitionUri` と `DefinitionBody` のどちらも指定されていない場合、SAM はテンプレート設定に基づいて `DefinitionBody` を生成します。  
ローカルファイルパスを指定する場合は、定義が適切に変換されるようにするために、テンプレートが `sam deploy` または `sam package` コマンドを含むワークフローを実行する必要があります。  
組み込み関数は、`DefinitionUri` で参照される外部 OpenApi ファイルではサポートされていません。その代わりに、[Include Transform](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html) で `DefinitionBody` プロパティを使用して、OpenApi 定義をテンプレートにインポートします。  
*タイプ*: 文字列 \$1 [ApiDefinition](sam-property-api-apidefinition.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[BodyS3Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-bodys3location)`プロパティに似ています。ネストされた Amazon S3 プロパティには異なる名前が付けられています。

 `Description`   <a name="sam-api-description"></a>
API リソースの説明です。  
タイプ：文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[Description](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-description)`プロパティに直接渡されます。

 `DisableExecuteApiEndpoint`   <a name="sam-api-disableexecuteapiendpoint"></a>
クライアントがデフォルトの `execute-api` エンドポイントを使用して API を呼び出すことができるかどうかを指定します。デフォルトでは、クライアントはデフォルトの `https://{api_id}.execute-api.{region}.amazonaws.com` を使用して API を呼び出すことができます。クライアントがカスタムドメイン名を使用して API を呼び出すように要求するには、`True` を指定します。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[ DisableExecuteApiEndpoint](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-disableexecuteapiendpoint)`プロパティに似ています。これは `[ x-amazon-apigateway-endpoint-configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html)` 拡張機能の `disableExecuteApiEndpoint` プロパティに直接渡され、`AWS::ApiGateway::RestApi` リソースの ` [ Body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-body)` プロパティに追加されます。

 `Domain`   <a name="sam-api-domain"></a>
この API Gateway API のカスタムドメインを設定します。  
*タイプ*: [DomainConfiguration](sam-property-api-domainconfiguration.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `EndpointConfiguration`   <a name="sam-api-endpointconfiguration"></a>
REST API のエンドポイントタイプです。  
*タイプ*: [EndpointConfiguration](sam-property-api-endpointconfiguration.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[EndpointConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-endpointconfiguration)`プロパティに似ています。ネストされた設定プロパティには異なる名前が付けられています。

 `FailOnWarnings`   <a name="sam-api-failonwarnings"></a>
警告が発生したときに、API 作成をロールバックするか (`true`)、しないか (`false`) を指定します。デフォルト値は `false` です。  
*タイプ*: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[FailOnWarnings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-failonwarnings)`プロパティに直接渡されます。

 `GatewayResponses`   <a name="sam-api-gatewayresponses"></a>
API のゲートウェイレスポンスを設定します。ゲートウェイレスポンスは、直接、または Lambda オーソライザーを使用して返される API Gateway からのレスポンスです。詳細については、[ゲートウェイレスポンス用の API Gateway OpenApi 拡張機能](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-gateway-responses.html)に関するドキュメントを参照してください。  
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `MergeDefinitions`   <a name="sam-api-mergedefinitions"></a>
AWS SAM は API イベントソースから OpenAPI 仕様を生成します。`AWS::Serverless::Api` リソースで定義されているインラインOpenAPI仕様にこれを AWS SAM マージ`true`するには、 を指定します。マージしない場合は `false` を指定します。  
`MergeDefinitions` では、`AWS::Serverless::Api` の `DefinitionBody` プロパティを定義する必要があります。`MergeDefinitions` は `AWS::Serverless::Api` の `DefinitionUri` プロパティと互換性がありません。  
*デフォルト値*: `false`  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `MethodSettings`   <a name="sam-api-methodsettings"></a>
ロギング、メトリクス、CacheTTL、スロットリングなどの API ステージのすべての設定を行います。  
*タイプ*: [MethodSetting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-stage-methodsetting.html) のリスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[MethodSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-methodsettings)`プロパティに直接渡されます。

 `MinimumCompressionSize`   <a name="sam-api-minimumcompressionsize"></a>
クライアントの Accept-Encoding ヘッダーに基づくレスポンス本文の圧縮を許可します。圧縮は、レスポンス本文のサイズが設定したしきい値以上の場合にトリガーされます。本文サイズの最大しきい値は 10 MB (10,485,760 バイト) です。gzip、deflate、および identity の圧縮タイプがサポートされます。  
*タイプ:* 整数  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[MinimumCompressionSize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-minimumcompressionsize)`プロパティに直接渡されます。

 `Mode`   <a name="sam-api-mode"></a>
このプロパティは、OpenAPI を使用して REST API を定義するときにのみ適用されます。`Mode` は、API Gateway がリソース更新を処理する方法を決定します。詳細については、[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html) リソースタイプの[Mode](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-mode)プロパティを参照してください。  
*有効な値*: `overwrite` または `merge`  
タイプ：文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[Mode](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-mode)`プロパティに直接渡されます。

 `Models`   <a name="sam-api-models"></a>
API メソッドで使用されるスキーマです。これらのスキーマは、JSON または YAML を使用して記述できます。サンプルモデルについては、このページの下部にある「例」セクションを参照してください。  
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Name`   <a name="sam-api-name"></a>
API Gateway RestApi リソースの名前です。  
タイプ：文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの `[Name](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-name)`プロパティに直接渡されます。

 `OpenApiVersion`   <a name="sam-api-openapiversion"></a>
使用する OpenApi のバージョンです。これは、Swagger 仕様の `2.0`、または `3.0.1` のような OpenApi 3.0 バージョンの 1 つにすることができます。OpenAPI の詳細については、「[OpenAPI Specification](https://swagger.io/specification/)」を参照してください。  
 AWS SAM は`Stage`デフォルトで というステージを作成します。このプロパティに有効な値を設定すると、ステージ `Stage` が作成されなくなります。
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

`PropagateTags`  <a name="sam-api-propagatetags"></a>
[AWS::Serverless::Api](sam-specification-generated-resources-api.md) が生成したリソースに `Tags` プロパティからのタグを渡すかどうかを指定します。`True` を指定して、生成されたリソースにタグを伝播します。  
型: ブール  
*必須:* いいえ  
*デフォルト*: `False`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

`Policy`  <a name="sam-api-policy"></a>
API の許可が含まれるポリシードキュメント。ポリシーの ARN を設定するには、区切り記号および `"execute-api:/"` と `"*"` の値として、`""` と `!Join` 組み込み関数を使用します。  
*Type*: JSON  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi`リソースの [ Policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-policy) プロパティに直接渡されます。

 `StageName`   <a name="sam-api-stagename"></a>
API Gateway が invoke Uniform Resource Identifier (URI) の最初のパスセグメントとして使用するステージの名前です。  
ステージリソースを参照するには、`<api-logical-id>.Stage` を使用します。[AWS::Serverless::Api](#sam-resource-api) リソースの指定時に生成されるリソースの参照に関する詳細については、「[CloudFormation AWS::Serverless::Apiが指定されているときに生成される リソース](sam-specification-generated-resources-api.md)」を参照してください。生成された CloudFormation リソースの一般的な情報については、「」を参照してください[の生成済み CloudFormation リソース AWS SAM](sam-specification-generated-resources.md)。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[StageName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-stagename)`プロパティに似ています。SAM では必須ですが、API Gateway では必須ではありません。  
*その他の注意点*: 暗黙的な API には「prod」という名前のステージがあります。

 `Tags`   <a name="sam-api-tags"></a>
この API Gateway ステージに追加されるタグを指定するマップ (文字列対文字列) です。タグの有効なキーと値の詳細については、*AWS CloudFormation ユーザーガイド*の[リソースタグ](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html)を参照してください。  
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[Tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-tags)`プロパティに似ています。SAM の Tags プロパティは、キーバリューペアで構成されています。CloudFormation では、タグオブジェクトのリストで構成されています。

 `TracingEnabled`   <a name="sam-api-tracingenabled"></a>
このステージに X-Ray を使用したアクティブトレーシングが有効化されているかどうかを示します。X-Ray の詳細については、*API Gateway デベロッパーガイド*の「[X-Ray を使用した REST API へのユーザーリクエストのトレース](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-xray.html)」を参照してください。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[TracingEnabled](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-tracingenabled)`プロパティに直接渡されます。

 `Variables`   <a name="sam-api-variables"></a>
ステージ変数を定義するマップ (文字列対文字列) で、変数名はキー、変数値は値です。変数名に使用できるのは英数字のみです。値は次の正規表現に一致する必要があります: `[A-Za-z0-9._~:/?#&=,-]+`。  
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::Stage`リソースの `[Variables](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-variables)`プロパティに直接渡されます。

## 戻り値
<a name="sam-resource-api-return-values"></a>

### 参照番号
<a name="sam-resource-api-return-values-ref"></a>

このリソースの論理 ID が `Ref` 組み込み関数に提供されると、基盤となる API Gateway API の ID が返されます。

`Ref` 関数の使用方法の詳細については、*AWS CloudFormation ユーザーガイド*の「[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)」を参照してください。

### Fn::GetAtt
<a name="sam-resource-api-return-values-fn--getatt"></a>

`Fn::GetAtt` は、このタイプの指定された属性の値を返します。利用可能な属性とサンプル戻り値は以下のとおりです。

`Fn::GetAtt` の使用の詳細については、*AWS CloudFormation ユーザーガイド*の「[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html)」を参照してください。

`RootResourceId`  <a name="RootResourceId-fn::getatt"></a>
`RestApi` リソースのルートソース ID (`a0bc123d4e` など) です。

## 例
<a name="sam-resource-api--examples"></a>

### SimpleApiExample
<a name="sam-resource-api--examples--simpleapiexample"></a>

API エンドポイントを持つ Lambda 関数を含む Hello World AWS SAM テンプレートファイル。これは、動作中のサーバーレスアプリケーションの完全な AWS SAM テンプレートファイルです。

#### YAML
<a name="sam-resource-api--examples--simpleapiexample--yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template with a simple API definition
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
  ApiFunction: # Adds a GET method at the root resource via an Api event
    Type: AWS::Serverless::Function
    Properties:
      Events:
        ApiEvent:
          Type: Api
          Properties:
            Path: /
            Method: get
            RestApiId:
              Ref: ApiGatewayApi
      Runtime: python3.10
      Handler: index.handler
      InlineCode: |
        def handler(event, context):
            return {'body': 'Hello World!', 'statusCode': 200}
```

### ApiCorsExample
<a name="sam-resource-api--examples--apicorsexample"></a>

Lambda 統合と CORS 設定とともに、外部 Swagger ファイルで定義された API を持つ AWS SAM テンプレートスニペット。これは、[AWS::Serverless::Api](#sam-resource-api)定義を示す AWS SAM テンプレートファイルの一部にすぎません。

#### YAML
<a name="sam-resource-api--examples--apicorsexample--yaml"></a>

```
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      # Allows www.example.com to call these APIs
      # SAM will automatically add AllowMethods with a list of methods for this API
      Cors: "'www.example.com'"
      DefinitionBody: # Pull in an OpenApi definition from S3
        'Fn::Transform':
          Name: 'AWS::Include'
          # Replace "bucket" with your bucket name
          Parameters:
            Location: s3://bucket/swagger.yaml
```

### ApiCognitoAuthExample
<a name="sam-resource-api--examples--apicognitoauthexample"></a>

Amazon Cognito を使用して API に対するリクエストを承認する API を含む AWS SAM テンプレートスニペット。これは、[AWS::Serverless::Api](#sam-resource-api)定義を示す AWS SAM テンプレートファイルの一部にすぎません。

#### YAML
<a name="sam-resource-api--examples--apicognitoauthexample--yaml"></a>

```
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      Cors: "'*'"
      Auth:
        DefaultAuthorizer: MyCognitoAuthorizer
        Authorizers:
          MyCognitoAuthorizer:
            UserPoolArn:
              Fn::GetAtt: [MyCognitoUserPool, Arn]
```

### ApiModelsExample
<a name="sam-resource-api--examples--apimodelsexample"></a>

Models スキーマを含む API を含む AWS SAM テンプレートスニペット。これは AWS SAM テンプレートファイルの一部にすぎず、2 つのモデルスキーマを持つ[AWS::Serverless::Api](#sam-resource-api)定義を示しています。

#### YAML
<a name="sam-resource-api--examples--apimodelsexample--yaml"></a>

```
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      Models:
        User:
          type: object
          required:
            - username
            - employee_id
          properties:
            username:
              type: string
            employee_id:
              type: integer
            department:
              type: string
        Item:
          type: object
          properties:
            count:
              type: integer
            category:
              type: string
            price:
              type: integer
```

### キャッシュの例
<a name="sam-resource-api--examples--caching-example"></a>

API エンドポイントを持つ Lambda 関数を含む Hello World AWS SAM テンプレートファイル。API では、1 つのリソースとメソッドに対してキャッシュが有効になっています。キャッシュの詳細については、「*API Gateway デベロッパーガイド*」の「[API キャッシュを有効にして応答性を強化する](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html)」を参照してください。

#### YAML
<a name="sam-resource-api--examples--caching-example--yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template with a simple API definition with caching turned on
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      CacheClusterEnabled: true
      CacheClusterSize: '0.5'
      MethodSettings:
        - ResourcePath: /
          HttpMethod: GET
          CachingEnabled: true
          CacheTtlInSeconds: 300
      Tags:
        CacheMethods: All 

  ApiFunction: # Adds a GET method at the root resource via an Api event
    Type: AWS::Serverless::Function
    Properties:
      Events:
        ApiEvent:
          Type: Api
          Properties:
            Path: /
            Method: get
            RestApiId:
              Ref: ApiGatewayApi
      Runtime: python3.10
      Handler: index.handler
      InlineCode: |
        def handler(event, context):
            return {'body': 'Hello World!', 'statusCode': 200}
```

### プライベート API を使用したカスタムドメインの例
<a name="sam-resource-api--examples--custom-domain-example"></a>

プライベートドメインにマッピングされた API エンドポイントを持つ Lambda 関数を含む Hello World AWS SAM テンプレートファイル。テンプレートはVPC エンドポイントとプライベートドメインの間にドメイン名アクセスの関連付けを作成します。詳細については、「[API Gateway でのプライベート API のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。

#### YAML
<a name="sam-resource-api--examples--custom-domain-example--yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS SAM template configured with a custom domain using a private API

Parameters:
    DomainName:
      Type: String
      Default: mydomain.example.com
    CertificateArn:
      Type: String
    HostedZoneId:
      Type: String
    VpcEndpointId:
      Type: String
    VpcEndpointDomainName:
      Type: String
    VpcEndpointHostedZoneId:
      Type: String

Resources:
  MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      InlineCode: |
        def handler(event, context):
            return {'body': 'Hello World!', 'statusCode': 200}
      Handler: index.handler
      Runtime: python3.13
      Events:
        Fetch:
          Type: Api
          Properties:
            RestApiId:
              Ref: MyApi
            Method: Get
            Path: /get
  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      EndpointConfiguration:
        Type: PRIVATE
        VPCEndpointIds:
        - !Ref VpcEndpointId
      Policy:
        Version: '2012-10-17		 	 	 '
        Statement:
        - Effect: Allow
          Principal: '*'
          Action: execute-api:Invoke
          Resource: execute-api:/*
        - Effect: Deny
          Principal: '*'
          Action: execute-api:Invoke
          Resource: execute-api:/*
          Condition:
            StringNotEquals:
              aws:SourceVpce: !Ref VpcEndpointId
      Domain:
        DomainName: !Ref DomainName
        CertificateArn: !Ref CertificateArn
        EndpointConfiguration: PRIVATE
        BasePath:
        - /
        Route53:
          HostedZoneId: !Ref HostedZoneId
          VpcEndpointDomainName: !Ref VpcEndpointDomainName
          VpcEndpointHostedZoneId: !Ref VpcEndpointHostedZoneId
        AccessAssociation:
          VpcEndpointId: !Ref VpcEndpointId
        Policy:
          Version: '2012-10-17		 	 	 '
          Statement:
          - Effect: Allow
            Principal: '*'
            Action: execute-api:Invoke
            Resource: execute-api:/*
          - Effect: Deny
            Principal: '*'
            Action: execute-api:Invoke
            Resource: execute-api:/*
            Condition:
              StringNotEquals:
                aws:SourceVpce: !Ref VpcEndpointId
```

# ApiAuth
<a name="sam-property-api-apiauth"></a>

API Gateway API へのアクセスを制御するための認可を設定します。

を使用してアクセスを設定するための詳細と例については、 AWS SAM 「」を参照してください[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md)。

## 構文
<a name="sam-property-api-apiauth-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-apiauth-syntax.yaml"></a>

```
  AddApiKeyRequiredToCorsPreflight: Boolean
  [AddDefaultAuthorizerToCorsPreflight](#sam-api-apiauth-adddefaultauthorizertocorspreflight): Boolean
  [ApiKeyRequired](#sam-api-apiauth-apikeyrequired): Boolean
  [Authorizers](#sam-api-apiauth-authorizers): CognitoAuthorizer | LambdaTokenAuthorizer | LambdaRequestAuthorizer | AWS_IAM
  [DefaultAuthorizer](#sam-api-apiauth-defaultauthorizer): String
  [InvokeRole](#sam-api-apiauth-invokerole): String
  [ResourcePolicy](#sam-api-apiauth-resourcepolicy): ResourcePolicyStatement
  [UsagePlan](#sam-api-apiauth-usageplan): ApiUsagePlan
```

**注記**  
`Authorizers` プロパティには `AWS_IAM` が含まれていますが、`AWS_IAM` に追加の設定は必要ありません。例については、[AWS IAM](#sam-property-api-apiauth--examples--aws_iam)を参照してください。

## プロパティ
<a name="sam-property-api-apiauth-properties"></a>

 `AddApiKeyRequiredToCorsPreflight`   <a name="sam-api-apiauth-addapikeyrequiredtocorspreflight"></a>
`ApiKeyRequired` プロパティと `Cors` プロパティが設定されている場合に `AddApiKeyRequiredToCorsPreflight` を設定すると、API キーが  `Options` プロパティに追加される場合があります。  
型: ブール  
*必須:* いいえ  
*デフォルト*: `True`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AddDefaultAuthorizerToCorsPreflight`   <a name="sam-api-apiauth-adddefaultauthorizertocorspreflight"></a>
`DefaultAuthorizer` プロパティと `Cors` プロパティが設定されている場合に `AddDefaultAuthorizerToCorsPreflight` を設定すると、OpenAPI セクションの `Options` プロパティにデフォルトのオーソライザーが追加されます。  
型: ブール  
*必須:* いいえ  
*デフォルト*: True  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ApiKeyRequired`   <a name="sam-api-apiauth-apikeyrequired"></a>
true に設定すると、すべての API イベントに API キーが必要になります。API キーの詳細については、*API Gateway デベロッパーガイド*の「[API キーを使用した使用量プランの作成と使用](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html)」を参照してください。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Authorizers`   <a name="sam-api-apiauth-authorizers"></a>
API Gateway API へのアクセスを制御するために使用されるオーソライザーです。  
詳細については、「[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md)」を参照してください。  
*タイプ*: [CognitoAuthorizer](sam-property-api-cognitoauthorizer.md) \$1 [LambdaTokenAuthorizer](sam-property-api-lambdatokenauthorizer.md) \$1 [LambdaRequestAuthorizer](sam-property-api-lambdarequestauthorizer.md) \$1 AWS\$1IAM  
*必須:* いいえ  
*デフォルト*: なし  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。  
*その他の注意点*: SAM は、API の OpenApi 定義にオーソライザーを追加します。

 `DefaultAuthorizer`   <a name="sam-api-apiauth-defaultauthorizer"></a>
API Gateway API のデフォルトオーソライザーを指定します。これは、デフォルトで API コールの認証に使用されます。  
この API に関連付けられた関数の Api EventSource が IAM アクセス許可を使用するように設定されている場合、このプロパティは `AWS_IAM` に設定する必要があります。それ以外に設定すると、エラーが発生します。
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: なし  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `InvokeRole`   <a name="sam-api-apiauth-invokerole"></a>
すべてのリソースとメソッドの統合認証情報をこの値に設定します。  
`CALLER_CREDENTIALS` が `arn:aws:iam:::<user>/` にマップされます。これは、発信者の認証情報を使用してエンドポイントを呼び出します。  
有効な値: `CALLER_CREDENTIALS`、`NONE`、`IAMRoleArn`  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: `CALLER_CREDENTIALS`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ResourcePolicy`   <a name="sam-api-apiauth-resourcepolicy"></a>
API 上のすべてのメソッドとパスのリソースポリシーを設定します。  
*タイプ*: [ResourcePolicyStatement](sam-property-api-resourcepolicystatement.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。  
*その他の注意点*: この設定は、`AWS::Serverless::Function` を使用して個々の [ApiFunctionAuth](sam-property-function-apifunctionauth.md) で定義することも可能です。これは、`EndpointConfiguration: PRIVATE` を使用した API に必要です。

 `UsagePlan`   <a name="sam-api-apiauth-usageplan"></a>
この API に関連付けられた使用量プランを設定します。使用量プランの詳細については、*API Gateway デベロッパーガイド*の「[API キーを使用した使用量プランの作成と使用](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html)」を参照してください。  
この AWS SAM プロパティが設定されている場合、このプロパティは [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html)、、 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html)の 3 つの追加 CloudFormation リソースを生成します[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html)。このシナリオの詳細については、「[UsagePlan プロパティが指定されている](sam-specification-generated-resources-api.md#sam-specification-generated-resources-api-usage-plan)」を参照してください。生成された CloudFormation リソースの一般的な情報については、「」を参照してください[の生成済み CloudFormation リソース AWS SAM](sam-specification-generated-resources.md)。  
*タイプ*: [APIusagePlan](sam-property-api-apiusageplan.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-apiauth--examples"></a>

### CognitoAuth
<a name="sam-property-api-apiauth--examples--cognitoauth"></a>

Cognito 認証の例

#### YAML
<a name="sam-property-api-apiauth--examples--cognitoauth--yaml"></a>

```
Auth:
  Authorizers:
    MyCognitoAuth:
     UserPoolArn:
       Fn::GetAtt:
         - MyUserPool
         - Arn
     AuthType: "COGNITO_USER_POOLS"
  DefaultAuthorizer: MyCognitoAuth
  InvokeRole: CALLER_CREDENTIALS
  AddDefaultAuthorizerToCorsPreflight: false
  ApiKeyRequired: false
  ResourcePolicy:
    CustomStatements: [{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "execute-api:Invoke",
      "Resource": "execute-api:/Prod/GET/pets",
      "Condition": {
          "IpAddress": {
              "aws:SourceIp": "1.2.3.4"
          }
        }
    }]
    IpRangeDenylist:
      - "10.20.30.40"
```

### AWS IAM
<a name="sam-property-api-apiauth--examples--aws_iam"></a>

AWS IAM の例

#### YAML
<a name="sam-property-api-apiauth--examples--cognitoauth--yaml"></a>

```
Auth:
  Authorizers: AWS_IAM
```

# ApiUsagePlan
<a name="sam-property-api-apiusageplan"></a>

API Gateway API の使用量プランを設定します。使用量プランの詳細については、*API Gateway デベロッパーガイド*の「[API キーを使用した使用量プランの作成と使用](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html)」を参照してください。

## 構文
<a name="sam-property-api-apiusageplan-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-apiusageplan-syntax.yaml"></a>

```
  [CreateUsagePlan](#sam-api-apiusageplan-createusageplan): String
  [Description](#sam-api-apiusageplan-description): String
  [Quota](#sam-api-apiusageplan-quota): [QuotaSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-quota)
  [Tags](#sam-api-apiusageplan-tags): List
  [Throttle](#sam-api-apiusageplan-throttle): [ThrottleSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-throttle)
  [UsagePlanName](#sam-api-apiusageplan-usageplanname): String
```

## プロパティ
<a name="sam-property-api-apiusageplan-properties"></a>

 `CreateUsagePlan`   <a name="sam-api-apiusageplan-createusageplan"></a>
この使用量プランの設定方法を決定します。有効な値は、`PER_API`、`SHARED`、`NONE` です。  
`PER_API` は、この API に固有の [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html)、[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html)、および [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html) リソースを作成します。これらのリソースには、それぞれ `<api-logical-id>UsagePlan`、`<api-logical-id>ApiKey`、および `<api-logical-id>UsagePlanKey` の論理 ID があります。  
`SHARED` は[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html)、同じ AWS SAM テンプレート`CreateUsagePlan: SHARED`に がある API 間で共有される [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html)、、および [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplankey.html)リソースを作成します。これらのリソースには、それぞれ `ServerlessUsagePlan`、`ServerlessApiKey`、および `ServerlessUsagePlanKey` の論理 ID があります。このオプションを使用する場合は、競合する定義と不確実な状態を避けるために、この使用量プランの設定を 1 つの API リソースだけに追加することが推奨されます。  
`NONE` は、この API の使用プランの作成または関連付けを無効にします。これは、[AWS SAM テンプレートのグローバルセクション](sam-specification-template-anatomy-globals.md) で `SHARED` または `PER_API` が指定されている場合にのみ必要になります。  
*有効な値*: `PER_API`、`SHARED`、`NONE`  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Description`   <a name="sam-api-apiusageplan-description"></a>
使用量プランの説明です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::UsagePlan`リソースの `[Description](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-description)`プロパティに直接渡されます。

 `Quota`   <a name="sam-api-apiusageplan-quota"></a>
指定された間隔内にユーザーが実行できるリクエストの数を設定します。  
*タイプ*: [QuotaSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-quota)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::UsagePlan`リソースの `[Quota](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-quota)`プロパティに直接渡されます。

 `Tags`   <a name="sam-api-apiusageplan-tags"></a>
使用量プランに関連付ける任意のタグの配列 (キーバリューペア) です。  
このプロパティは、[CloudFormation のタグタイプ](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html)を使用します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::UsagePlan`リソースの `[Tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-tags)`プロパティに直接渡されます。

 `Throttle`   <a name="sam-api-apiusageplan-throttle"></a>
全体的なリクエスト率 (1 秒あたりの平均リクエスト数) とバーストキャパシティを設定します。  
*タイプ*: [ThrottleSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-throttle)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::UsagePlan`リソースの `[Throttle](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-throttle)`プロパティに直接渡されます。

 `UsagePlanName`   <a name="sam-api-apiusageplan-usageplanname"></a>
使用量プランの名前です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::UsagePlan`リソースの `[UsagePlanName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-usageplan.html#cfn-apigateway-usageplan-usageplanname)`プロパティに直接渡されます。

## 例
<a name="sam-property-api-apiusageplan--examples"></a>

### UsagePlan
<a name="sam-property-api-apiusageplan--examples--usageplan"></a>

以下は、使用量プランの例です。

#### YAML
<a name="sam-property-api-apiusageplan--examples--usageplan--yaml"></a>

```
Auth:
  UsagePlan:
    CreateUsagePlan: PER_API
    Description: Usage plan for this API
    Quota:
      Limit: 500
      Period: MONTH
    Throttle:
      BurstLimit: 100
      RateLimit: 50
    Tags:
      - Key: TagName
        Value: TagValue
```

# CognitoAuthorizer
<a name="sam-property-api-cognitoauthorizer"></a>

Amazon Cognito ユーザープールオーソライザーを定義します。

詳細情報と例については、「[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md)」を参照してください。

## 構文
<a name="sam-property-api-cognitoauthorizer-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-cognitoauthorizer-syntax.yaml"></a>

```
  [AuthorizationScopes](#sam-api-cognitoauthorizer-authorizationscopes): List
  [Identity](#sam-api-cognitoauthorizer-identity): CognitoAuthorizationIdentity
  [UserPoolArn](#sam-api-cognitoauthorizer-userpoolarn): String
```

## プロパティ
<a name="sam-property-api-cognitoauthorizer-properties"></a>

 `AuthorizationScopes`   <a name="sam-api-cognitoauthorizer-authorizationscopes"></a>
このオーソライザーの認可スコープのリストです。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Identity`   <a name="sam-api-cognitoauthorizer-identity"></a>
このプロパティは、オーソライザーの受信リクエストに `IdentitySource` を指定するために使用できます。  
*タイプ*: [CognitoAuthorizationIdentity](sam-property-api-cognitoauthorizationidentity.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `UserPoolArn`   <a name="sam-api-cognitoauthorizer-userpoolarn"></a>
この Cognito オーソライザーを追加するユーザープールを参照する、またはユーザープール arn を指定することができます  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-cognitoauthorizer--examples"></a>

### CognitoAuth
<a name="sam-property-api-cognitoauthorizer--examples--cognitoauth"></a>

Cognito 認証の例です。

#### YAML
<a name="sam-property-api-cognitoauthorizer--examples--cognitoauth--yaml"></a>

```
Auth:
  Authorizers:
    MyCognitoAuth:
      AuthorizationScopes:
        - scope1
        - scope2
      UserPoolArn:
        Fn::GetAtt:
          - MyCognitoUserPool
          - Arn
      Identity:
        Header: MyAuthorizationHeader
        ValidationExpression: myauthvalidationexpression
```

# CognitoAuthorizationIdentity
<a name="sam-property-api-cognitoauthorizationidentity"></a>

このプロパティは、オーソライザーの受信リクエストに IdentitySource を指定するために使用できます。IdentitySource の詳細については、「[ApiGateway オーソライザーの OpenApi 拡張機能](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-authorizer.html)」を参照してください。

## 構文
<a name="sam-property-api-cognitoauthorizationidentity-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-cognitoauthorizationidentity-syntax.yaml"></a>

```
  [Header](#sam-api-cognitoauthorizationidentity-header): String
  [ReauthorizeEvery](#sam-api-cognitoauthorizationidentity-reauthorizeevery): Integer
  [ValidationExpression](#sam-api-cognitoauthorizationidentity-validationexpression): String
```

## プロパティ
<a name="sam-property-api-cognitoauthorizationidentity-properties"></a>

 `Header`   <a name="sam-api-cognitoauthorizationidentity-header"></a>
OpenApi 定義で認可用のヘッダー名を指定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: Authorization  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ReauthorizeEvery`   <a name="sam-api-cognitoauthorizationidentity-reauthorizeevery"></a>
API Gateway がオーソライザー結果をキャッシュする時間を指定する有効期限 (TTL) (秒) です。0 より大きい値を指定する場合、API Gateway が認証レスポンスをキャッシュします。デフォルトで、API Gateway はこのプロパティを 300 に設定します。最大値は 3600、つまり 1 時間です。  
*タイプ*: 整数  
*必須:* いいえ  
*デフォルト*: 300  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ValidationExpression`   <a name="sam-api-cognitoauthorizationidentity-validationexpression"></a>
受信アイデンティティを検証するための検証式を指定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-cognitoauthorizationidentity--examples"></a>

### CognitoAuthIdentity
<a name="sam-property-api-cognitoauthorizationidentity--examples--cognitoauthidentity"></a>

#### YAML
<a name="sam-property-api-cognitoauthorizationidentity--examples--cognitoauthidentity--yaml"></a>

```
Identity:
  Header: MyCustomAuthHeader
  ValidationExpression: Bearer.*
  ReauthorizeEvery: 30
```

# LambdaRequestAuthorizer
<a name="sam-property-api-lambdarequestauthorizer"></a>

Lambda 関数を使用して、API へのアクセスを制御するように Lambda オーソライザーを設定します。

詳細な説明と例については、[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md) を参照してください。

## 構文
<a name="sam-property-api-lambdarequestauthorizer-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-lambdarequestauthorizer-syntax.yaml"></a>

```
DisableFunctionDefaultPermissions: Boolean
[FunctionArn](#sam-api-lambdarequestauthorizer-functionarn): String
[FunctionInvokeRole](#sam-api-lambdarequestauthorizer-functioninvokerole): String
[FunctionPayloadType](#sam-api-lambdarequestauthorizer-functionpayloadtype): String
[Identity](#sam-api-lambdarequestauthorizer-identity): LambdaRequestAuthorizationIdentity
```

## プロパティ
<a name="sam-property-api-lambdarequestauthorizer-properties"></a>

 `DisableFunctionDefaultPermissions`   <a name="sam-api-lambdarequestauthorizer-disablefunctiondefaultpermissions"></a>
`true` リソースとオーソライザー Lambda 関数間のアクセス許可をプロビジョニング`AWS::Lambda::Permissions`する `AWS::Serverless::Api`リソースが によって自動的に作成 AWS SAM されないように を指定します。  
*デフォルト値*: `false`  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionArn`   <a name="sam-api-lambdarequestauthorizer-functionarn"></a>
API に対する認可を提供する Lambda 関数の関数 ARN を指定します。  
AWS SAM が に指定されていると、 `FunctionArn`は自動的に `AWS::Lambda::Permissions`リソースを作成します`AWS::Serverless::Api`。`AWS::Lambda::Permissions` リソースは、API とオーソライザー Lambda 関数の間の許可をプロビジョニングします。
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionInvokeRole`   <a name="sam-api-lambdarequestauthorizer-functioninvokerole"></a>
オーソライザーの認証情報を Lambda オーソライザーの OpenApi 定義に追加します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionPayloadType`   <a name="sam-api-lambdarequestauthorizer-functionpayloadtype"></a>
このプロパティは、API の Lambda オーソライザーのタイプを定義するために使用できます。  
*有効な値*: `TOKEN` または `REQUEST`  
タイプ：文字列  
*必須:* いいえ  
*デフォルト*: `TOKEN`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Identity`   <a name="sam-api-lambdarequestauthorizer-identity"></a>
このプロパティは、オーソライザーの受信リクエストに `IdentitySource` を指定するために使用できます。このプロパティが必要になるのは、`FunctionPayloadType` プロパティが `REQUEST` に設定されている場合のみです。  
*タイプ*: [LambdaRequestAuthorizationIdentity](sam-property-api-lambdarequestauthorizationidentity.md)  
*必須*: 条件に応じて異なります  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-lambdarequestauthorizer--examples"></a>

### LambdaRequestAuth
<a name="sam-property-api-lambdarequestauthorizer--examples--lambdarequestauth"></a>

#### YAML
<a name="sam-property-api-lambdarequestauthorizer--examples--lambdarequestauth--yaml"></a>

```
Authorizers:
  MyLambdaRequestAuth:
    FunctionPayloadType: REQUEST
    FunctionArn:
      Fn::GetAtt:
        - MyAuthFunction
        - Arn
    FunctionInvokeRole:
      Fn::GetAtt:
        - LambdaAuthInvokeRole
        - Arn
    Identity:
      Headers:
        - Authorization1
```

# LambdaRequestAuthorizationIdentity
<a name="sam-property-api-lambdarequestauthorizationidentity"></a>

このプロパティは、オーソライザーの受信リクエストに IdentitySource を指定するために使用できます。IdentitySource の詳細については、「[ApiGateway オーソライザーの OpenApi 拡張機能](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-authorizer.html)」を参照してください。

## 構文
<a name="sam-property-api-lambdarequestauthorizationidentity-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-lambdarequestauthorizationidentity-syntax.yaml"></a>

```
  [Context](#sam-api-lambdarequestauthorizationidentity-context): List
  [Headers](#sam-api-lambdarequestauthorizationidentity-headers): List
  [QueryStrings](#sam-api-lambdarequestauthorizationidentity-querystrings): List
  [ReauthorizeEvery](#sam-api-lambdarequestauthorizationidentity-reauthorizeevery): Integer
  [StageVariables](#sam-api-lambdarequestauthorizationidentity-stagevariables): List
```

## プロパティ
<a name="sam-property-api-lambdarequestauthorizationidentity-properties"></a>

 `Context`   <a name="sam-api-lambdarequestauthorizationidentity-context"></a>
所定のコンテキスト文字列を `context.contextString` 形式のマッピング式に変換します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Headers`   <a name="sam-api-lambdarequestauthorizationidentity-headers"></a>
ヘッダーを、`method.request.header.name` 形式のマッピング式のカンマ区切り文字列に変換します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `QueryStrings`   <a name="sam-api-lambdarequestauthorizationidentity-querystrings"></a>
所定のクエリ文字列を、`method.request.querystring.queryString` 形式のマッピング式のカンマ区切り文字列に変換します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ReauthorizeEvery`   <a name="sam-api-lambdarequestauthorizationidentity-reauthorizeevery"></a>
API Gateway がオーソライザー結果をキャッシュする時間を指定する有効期限 (TTL) (秒) です。0 より大きい値を指定する場合、API Gateway が認証レスポンスをキャッシュします。デフォルトで、API Gateway はこのプロパティを 300 に設定します。最大値は 3600、つまり 1 時間です。  
*タイプ*: 整数  
*必須:* いいえ  
*デフォルト*: 300  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `StageVariables`   <a name="sam-api-lambdarequestauthorizationidentity-stagevariables"></a>
所定のステージ変数を、`stageVariables.stageVariable` 形式のマッピング式のカンマ区切り文字列に変換します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-lambdarequestauthorizationidentity--examples"></a>

### LambdaRequestIdentity
<a name="sam-property-api-lambdarequestauthorizationidentity--examples--lambdarequestidentity"></a>

#### YAML
<a name="sam-property-api-lambdarequestauthorizationidentity--examples--lambdarequestidentity--yaml"></a>

```
Identity:
  QueryStrings:
    - auth
  Headers:
    - Authorization
  StageVariables:
    - VARIABLE
  Context:
    - authcontext
  ReauthorizeEvery: 100
```

# LambdaTokenAuthorizer
<a name="sam-property-api-lambdatokenauthorizer"></a>

Lambda 関数を使用して、API へのアクセスを制御するように Lambda オーソライザーを設定します。

詳細な説明と例については、[AWS SAM テンプレートを使用して API アクセスを制御する](serverless-controlling-access-to-apis.md) を参照してください。

## 構文
<a name="sam-property-api-lambdatokenauthorizer-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-lambdatokenauthorizer-syntax.yaml"></a>

```
DisableFunctionDefaultPermissions: Boolean
[FunctionArn](#sam-api-lambdatokenauthorizer-functionarn): String
[FunctionInvokeRole](#sam-api-lambdatokenauthorizer-functioninvokerole): String
[FunctionPayloadType](#sam-api-lambdatokenauthorizer-functionpayloadtype): String
[Identity](#sam-api-lambdatokenauthorizer-identity): LambdaTokenAuthorizationIdentity
```

## プロパティ
<a name="sam-property-api-lambdatokenauthorizer-properties"></a>

 `DisableFunctionDefaultPermissions`   <a name="sam-api-lambdatokenauthorizer-disablefunctiondefaultpermissions"></a>
`true` リソースとオーソライザー Lambda 関数間のアクセス許可をプロビジョニング`AWS::Lambda::Permissions`する `AWS::Serverless::Api`リソースが によって自動的に作成 AWS SAM されないように を指定します。  
*デフォルト値*: `false`  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionArn`   <a name="sam-api-lambdatokenauthorizer-functionarn"></a>
API に対する認可を提供する Lambda 関数の関数 ARN を指定します。  
AWS SAM が に指定されていると、 `FunctionArn`は自動的に `AWS::Lambda::Permissions`リソースを作成します`AWS::Serverless::Api`。`AWS::Lambda::Permissions` リソースは、API とオーソライザー Lambda 関数の間の許可をプロビジョニングします。
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionInvokeRole`   <a name="sam-api-lambdatokenauthorizer-functioninvokerole"></a>
オーソライザーの認証情報を Lambda オーソライザーの OpenApi 定義に追加します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionPayloadType`   <a name="sam-api-lambdatokenauthorizer-functionpayloadtype"></a>
このプロパティは、API の Lambda オーソライザーのタイプを定義するために使用できます。  
*有効な値*: `TOKEN` または `REQUEST`  
タイプ：文字列  
*必須:* いいえ  
*デフォルト*: `TOKEN`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `Identity`   <a name="sam-api-lambdatokenauthorizer-identity"></a>
このプロパティは、オーソライザーの受信リクエストに `IdentitySource` を指定するために使用できます。このプロパティが必要になるのは、`FunctionPayloadType` プロパティが `REQUEST` に設定されている場合のみです。  
*タイプ*: [LambdaTokenAuthorizationIdentity](sam-property-api-lambdatokenauthorizationidentity.md)  
*必須*: 条件に応じて異なります  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-lambdatokenauthorizer--examples"></a>

### LambdaTokenAuth
<a name="sam-property-api-lambdatokenauthorizer--examples--lambdatokenauth"></a>

#### YAML
<a name="sam-property-api-lambdatokenauthorizer--examples--lambdatokenauth--yaml"></a>

```
Authorizers:
  MyLambdaTokenAuth:
    FunctionArn:
      Fn::GetAtt:
        - MyAuthFunction
        - Arn
    Identity:
      Header: MyCustomAuthHeader # OPTIONAL; Default: 'Authorization'
      ValidationExpression: mycustomauthexpression # OPTIONAL
      ReauthorizeEvery: 20 # OPTIONAL; Service Default: 300
```

### BasicLambdaTokenAuth
<a name="sam-property-api-lambdatokenauthorizer--examples--basiclambdatokenauth"></a>

#### YAML
<a name="sam-property-api-lambdatokenauthorizer--examples--basiclambdatokenauth--yaml"></a>

```
Authorizers:
  MyLambdaTokenAuth:
    FunctionArn:
      Fn::GetAtt:
        - MyAuthFunction
        - Arn
```

# LambdaTokenAuthorizationIdentity
<a name="sam-property-api-lambdatokenauthorizationidentity"></a>

このプロパティは、オーソライザーの受信リクエストに IdentitySource を指定するために使用できます。IdentitySource の詳細については、「[ApiGateway オーソライザーの OpenApi 拡張機能](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-authorizer.html)」を参照してください。

## 構文
<a name="sam-property-api-lambdatokenauthorizationidentity-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-lambdatokenauthorizationidentity-syntax.yaml"></a>

```
  [Header](#sam-api-lambdatokenauthorizationidentity-header): String
  [ReauthorizeEvery](#sam-api-lambdatokenauthorizationidentity-reauthorizeevery): Integer
  [ValidationExpression](#sam-api-lambdatokenauthorizationidentity-validationexpression): String
```

## プロパティ
<a name="sam-property-api-lambdatokenauthorizationidentity-properties"></a>

 `Header`   <a name="sam-api-lambdatokenauthorizationidentity-header"></a>
OpenApi 定義で認可用のヘッダー名を指定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: Authorization  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ReauthorizeEvery`   <a name="sam-api-lambdatokenauthorizationidentity-reauthorizeevery"></a>
API Gateway がオーソライザー結果をキャッシュする時間を指定する有効期限 (TTL) (秒) です。0 より大きい値を指定する場合、API Gateway が認証レスポンスをキャッシュします。デフォルトで、API Gateway はこのプロパティを 300 に設定します。最大値は 3600、つまり 1 時間です。  
*タイプ*: 整数  
*必須:* いいえ  
*デフォルト*: 300  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ValidationExpression`   <a name="sam-api-lambdatokenauthorizationidentity-validationexpression"></a>
受信アイデンティティを検証するための検証式を指定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-lambdatokenauthorizationidentity--examples"></a>

### LambdaTokenIdentity
<a name="sam-property-api-lambdatokenauthorizationidentity--examples--lambdatokenidentity"></a>

#### YAML
<a name="sam-property-api-lambdatokenauthorizationidentity--examples--lambdatokenidentity--yaml"></a>

```
Identity:
  Header: MyCustomAuthHeader
  ValidationExpression: Bearer.*
  ReauthorizeEvery: 30
```

# ResourcePolicyStatement
<a name="sam-property-api-resourcepolicystatement"></a>

API 上のすべてのメソッドとパスのリソースポリシーを設定します。リソースポリシーの詳細については、*API Gateway デベロッパーガイド*の「[API Gateway リソースポリシーを使用して API へのアクセスを制御する](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-resource-policies.html)」を参照してください。

## 構文
<a name="sam-property-api-resourcepolicystatement-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-resourcepolicystatement-syntax.yaml"></a>

```
  [AwsAccountBlacklist](#sam-api-resourcepolicystatement-awsaccountblacklist): List
  [AwsAccountWhitelist](#sam-api-resourcepolicystatement-awsaccountwhitelist): List
  [CustomStatements](#sam-api-resourcepolicystatement-customstatements): List
  [IntrinsicVpcBlacklist](#sam-api-resourcepolicystatement-intrinsicvpcblacklist): List
  [IntrinsicVpcWhitelist](#sam-api-resourcepolicystatement-intrinsicvpcwhitelist): List
  [IntrinsicVpceBlacklist](#sam-api-resourcepolicystatement-intrinsicvpceblacklist): List
  [IntrinsicVpceWhitelist](#sam-api-resourcepolicystatement-intrinsicvpcewhitelist): List
  [IpRangeBlacklist](#sam-api-resourcepolicystatement-iprangeblacklist): List
  [IpRangeWhitelist](#sam-api-resourcepolicystatement-iprangewhitelist): List
  [SourceVpcBlacklist](#sam-api-resourcepolicystatement-sourcevpcblacklist): List
  [SourceVpcWhitelist](#sam-api-resourcepolicystatement-sourcevpcwhitelist): List
```

## プロパティ
<a name="sam-property-api-resourcepolicystatement-properties"></a>

 `AwsAccountBlacklist`   <a name="sam-api-resourcepolicystatement-awsaccountblacklist"></a>
ブロックする AWS アカウント。  
型: 文字列のリスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AwsAccountWhitelist`   <a name="sam-api-resourcepolicystatement-awsaccountwhitelist"></a>
許可する AWS アカウント。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
型: 文字列のリスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。

 `CustomStatements`   <a name="sam-api-resourcepolicystatement-customstatements"></a>
この API に適用するカスタムリソースポリシーステートメントのリストです。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `IntrinsicVpcBlacklist`   <a name="sam-api-resourcepolicystatement-intrinsicvpcblacklist"></a>
ブロックする仮想プライベートクラウド (VPC) のリストで、各 VPC が[動的参照](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html)または `Ref` [組み込み関数](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)などのリファレンスとして指定されます。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `IntrinsicVpcWhitelist`   <a name="sam-api-resourcepolicystatement-intrinsicvpcwhitelist"></a>
許可する VPC のリストで、各 VPC が[動的参照](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html)または `Ref` [組み込み関数](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)などのリファレンスとして指定されます。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。

 `IntrinsicVpceBlacklist`   <a name="sam-api-resourcepolicystatement-intrinsicvpceblacklist"></a>
ブロックする VPC エンドポイントのリストで、各 VPC エンドポイントが[動的参照](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html)または `Ref` [組み込み関数](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)などのリファレンスとして指定されます。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `IntrinsicVpceWhitelist`   <a name="sam-api-resourcepolicystatement-intrinsicvpcewhitelist"></a>
許可する VPC エンドポイントのリストで、各 VPC エンドポイントが[動的参照](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html)または `Ref` [組み込み関数](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)などのリファレンスとして指定されます。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `IpRangeBlacklist`   <a name="sam-api-resourcepolicystatement-iprangeblacklist"></a>
ブロックする IP アドレスまたはアドレス範囲です。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `IpRangeWhitelist`   <a name="sam-api-resourcepolicystatement-iprangewhitelist"></a>
許可する IP アドレスまたはアドレス範囲です。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `SourceVpcBlacklist`   <a name="sam-api-resourcepolicystatement-sourcevpcblacklist"></a>
ブロックするソース VPC またはソース VPC エンドポイントです。ソース VPC 名は `"vpc-"` で始まり、ソース VPC エンドポイント名は `"vpce-"` で始まる必要があります。このプロパティの使用例については、このページの下部にある「例」セクションを参照してください。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `SourceVpcWhitelist`   <a name="sam-api-resourcepolicystatement-sourcevpcwhitelist"></a>
許可するソース VPC またはソース VPC エンドポイントです。ソース VPC 名は `"vpc-"` で始まり、ソース VPC エンドポイント名は `"vpce-"` で始まる必要があります。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-resourcepolicystatement--examples"></a>

### リソースポリシーの例
<a name="sam-property-api-resourcepolicystatement--examples--resource-policy-example"></a>

次の例では、2 つの IP アドレスとソース VPC をブロックし、 AWS アカウントを許可します。

#### YAML
<a name="sam-property-api-resourcepolicystatement--examples--resource-policy-example--yaml"></a>

```
Auth:
  ResourcePolicy:
    CustomStatements: [{
                         "Effect": "Allow",
                         "Principal": "*",
                         "Action": "execute-api:Invoke",
                         "Resource": "execute-api:/Prod/GET/pets",
                         "Condition": {
                           "IpAddress": {
                             "aws:SourceIp": "1.2.3.4"
                           }
                         }
                       }]
    IpRangeBlacklist:
      - "10.20.30.40"
      - "1.2.3.4"
    SourceVpcBlacklist:
      - "vpce-1a2b3c4d"
    AwsAccountWhitelist:
      - "111122223333"
    IntrinsicVpcBlacklist:
      - "{{resolve:ssm:SomeVPCReference:1}}" 
      - !Ref MyVPC
    IntrinsicVpceWhitelist:
      - "{{resolve:ssm:SomeVPCEReference:1}}" 
      - !Ref MyVPCE
```

# ApiDefinition
<a name="sam-property-api-apidefinition"></a>

API を定義する OpenAPI ドキュメントです。

## 構文
<a name="sam-property-api-apidefinition-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-apidefinition-syntax.yaml"></a>

```
  [Bucket](#sam-api-apidefinition-bucket): String
  [Key](#sam-api-apidefinition-key): String
  [Version](#sam-api-apidefinition-version): String
```

## プロパティ
<a name="sam-property-api-apidefinition-properties"></a>

 `Bucket`   <a name="sam-api-apidefinition-bucket"></a>
OpenAPI ファイルが保存されている Amazon S3 バケットの名前です。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `S3Location` データ型の `[Bucket](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-bucket)`プロパティに直接渡されます。

 `Key`   <a name="sam-api-apidefinition-key"></a>
OpenAPI ファイルの Amazon S3 キーです。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `S3Location` データ型の `[Key](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-key)`プロパティに直接渡されます。

 `Version`   <a name="sam-api-apidefinition-version"></a>
バージョン管理されたオブジェクトの場合は、OpenAPI ファイルのバージョンです。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `S3Location` データ型の `[Version](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-version)`プロパティに直接渡されます。

## 例
<a name="sam-property-api-apidefinition--examples"></a>

### 定義 URI の例
<a name="sam-property-api-apidefinition--examples--definition-uri-example"></a>

API 定義の例

#### YAML
<a name="sam-property-api-apidefinition--examples--definition-uri-example--yaml"></a>

```
DefinitionUri:
  Bucket: amzn-s3-demo-bucket-name
  Key: mykey-name
  Version: 121212
```

# CorsConfiguration
<a name="sam-property-api-corsconfiguration"></a>

API Gateway API のクロスオリジンリソース共有 (CORS) を管理します。許可するドメインを文字列として指定するか、追加の CORS 設定でディクショナリを指定します。

**注記**  
CORS では AWS SAM 、OpenAPI 定義を変更する必要があります。CORS を有効にするには、`DefinitionBody` の中でインライン OpenAPI 定義を作成します。`CorsConfiguration` が OpenAPI 定義とプロパティレベルで設定されている場合、 はそれらを AWS SAM マージします。プロパティレベルは OpenAPI 定義よりも優先されます。

CORS の詳細については、*Amazon API Gateway デベロッパーガイド*の「[REST API リソースの CORS を有効にする](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html)」を参照してください。

## 構文
<a name="sam-property-api-corsconfiguration-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-corsconfiguration-syntax.yaml"></a>

```
  [AllowCredentials](#sam-api-corsconfiguration-allowcredentials): Boolean
  [AllowHeaders](#sam-api-corsconfiguration-allowheaders): String
  [AllowMethods](#sam-api-corsconfiguration-allowmethods): String
  [AllowOrigin](#sam-api-corsconfiguration-alloworigin): String
  [MaxAge](#sam-api-corsconfiguration-maxage): String
```

## プロパティ
<a name="sam-property-api-corsconfiguration-properties"></a>

 `AllowCredentials`   <a name="sam-api-corsconfiguration-allowcredentials"></a>
リクエストに認証情報を含めることができるかどうかを示すブール値です。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AllowHeaders`   <a name="sam-api-corsconfiguration-allowheaders"></a>
許可するヘッダーの文字列です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AllowMethods`   <a name="sam-api-corsconfiguration-allowmethods"></a>
許可する HTTP メソッドが含まれる文字列です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AllowOrigin`   <a name="sam-api-corsconfiguration-alloworigin"></a>
許可するオリジンの文字列です。これは、文字列形式のカンマ区切りリストになります。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `MaxAge`   <a name="sam-api-corsconfiguration-maxage"></a>
CORS プリフライトリクエストをキャッシュする秒数が含まれる文字列です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-api-corsconfiguration--examples"></a>

### CorsConfiguration
<a name="sam-property-api-corsconfiguration--examples--corsconfiguration"></a>

CORS 設定の例です。これは、CORS が設定された[AWS::Serverless::Api](sam-resource-api.md)定義と を示す AWS SAM テンプレートファイルの一部にすぎません[AWS::Serverless::Function](sam-resource-function.md)。Lambda プロキシ統合または HTTP プロキシ統合を使用する場合、バックエンドが `Access-Control-Allow-Origin`、`Access-Control-Allow-Methods`、および `Access-Control-Allow-Headers`ヘッダーを返す必要があります。

#### YAML
<a name="sam-property-api-corsconfiguration--examples--corsconfiguration--yaml"></a>

```
Resources:
  ApiGatewayApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      Cors:
        AllowMethods: "'POST, GET'"
        AllowHeaders: "'X-Forwarded-For'"
        AllowOrigin: "'https://example.com'"
        MaxAge: "'600'"
        AllowCredentials: true
  ApiFunction: # Adds a GET method at the root resource via an Api event
    Type: AWS::Serverless::Function
    Properties:
      Events:
        ApiEvent:
          Type: Api
          Properties:
            Path: /
            Method: get
            RestApiId:
              Ref: ApiGatewayApi
      Runtime: python3.10
      Handler: index.handler
      InlineCode: |
        import json
        def handler(event, context):
          return {
          'statusCode': 200,
          'headers': {
            'Access-Control-Allow-Headers': 'Content-Type',
            'Access-Control-Allow-Origin': 'https://example.com',
            'Access-Control-Allow-Methods': 'POST, GET'
            },
          'body': json.dumps('Hello from Lambda!')
          }
```

# DomainConfiguration
<a name="sam-property-api-domainconfiguration"></a>

API のカスタムドメインを設定します。

## 構文
<a name="sam-property-api-domainconfiguration-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-domainconfiguration-syntax.yaml"></a>

```
  [AccessAssociation](#sam-api-domainconfiguration-domainaccessassociation): DomainAccessAssociation
  [BasePath](#sam-api-domainconfiguration-basepath): List
  [CertificateArn](#sam-api-domainconfiguration-certificatearn): String
  [DomainName](#sam-api-domainconfiguration-domainname): String
  [EndpointConfiguration](#sam-api-domainconfiguration-endpointconfiguration): String
  [MutualTlsAuthentication](#sam-api-domainconfiguration-mutualtlsauthentication): [MutualTlsAuthentication](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-mutualtlsauthentication)
  [NormalizeBasePath](#sam-api-domainconfiguration-normalizebasepath): Boolean
  [OwnershipVerificationCertificateArn](#sam-api-domainconfiguration-ownershipverificationcertificatearn): String
  [Policy: ](#sam-api-domainconfiguration-policy)Json
  [Route53](#sam-api-domainconfiguration-route53): Route53Configuration
  [SecurityPolicy](#sam-api-domainconfiguration-securitypolicy): String
```

## プロパティ
<a name="sam-property-api-domainconfiguration-properties"></a>

 `AccessAssociation`   <a name="sam-api-domainconfiguration-domainaccessassociation"></a>
` AWS::ApiGateway::DomainNameAccessAssociation` リソースの生成に必要な設定。  
AWS SAM このプロパティが設定されると、 は [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnameaccessassociation.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnameaccessassociation.html)リソースを生成します。生成された CloudFormation リソースの詳細については、「」を参照してください[の生成済み CloudFormation リソース AWS SAM](sam-specification-generated-resources.md)。  
*タイプ*: [DomainAccessAssociation](sam-property-api-domainaccessassociation.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `BasePath`   <a name="sam-api-domainconfiguration-basepath"></a>
Amazon API Gateway ドメイン名で設定する basepaths のリストです。  
*タイプ*: リスト  
*必須:* いいえ  
*デフォルト*: /  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::BasePathMapping` resource. AWS SAM creates の `[BasePath](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-basepath)` プロパティに似ています。このプロパティで`BasePath`指定された ごとに 1 つずつ、複数の`AWS::ApiGateway::BasePathMapping`リソースを作成します。

 `CertificateArn`   <a name="sam-api-domainconfiguration-certificatearn"></a>
このドメイン名のエンドポイントの AWS マネージド証明書の Amazon リソースネーム (ARN)。 は、サポートされている唯一のソース AWS Certificate Manager です。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainName`リソースの `[CertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-certificatearn)`プロパティに似ています。`EndpointConfiguration` が `REGIONAL` (デフォルト値) に設定されている場合、`CertificateArn` は `AWS::ApiGateway::DomainName` の [RegionalCertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-regionalcertificatearn) にマップされます。`EndpointConfiguration` が `EDGE` に設定されている場合、`CertificateArn` は `AWS::ApiGateway::DomainName` の [CertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-certificatearn) にマップされます。`EndpointConfiguration` が `PRIVATE` に設定されている場合、このプロパティは [AWS::ApiGateway::DomainNameV2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2) リソースに渡されます。  
*その他の注意*: `EDGE`エンドポイントの場合は、 `us-east-1` AWS リージョンで証明書を作成する必要があります。

 `DomainName`   <a name="sam-api-domainconfiguration-domainname"></a>
API Gateway API のカスタムドメイン名です。大文字はサポートされていません。  
AWS SAM このプロパティが設定されると、 は [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html)リソースを生成します。このシナリオの詳細については、「[DomainName プロパティが指定されている](sam-specification-generated-resources-api.md#sam-specification-generated-resources-api-domain-name)」を参照してください。生成された CloudFormation リソースの詳細については、「」を参照してください[の生成済み CloudFormation リソース AWS SAM](sam-specification-generated-resources.md)。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainName`リソースの `[DomainName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-domainname)`プロパティに直接渡されるか、EndpointConfiguration が に設定されている[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2)ときに に渡されます`PRIVATE`。

 `EndpointConfiguration`   <a name="sam-api-domainconfiguration-endpointconfiguration"></a>
カスタムドメインにマップする API Gateway エンドポイントのタイプを定義します。このプロパティの値は、`CertificateArn`プロパティのマッピング方法を決定します CloudFormation。  
*有効な値*: `EDGE`、`REGIONAL`、または `PRIVATE`  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: `REGIONAL`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `MutualTlsAuthentication`   <a name="sam-api-domainconfiguration-mutualtlsauthentication"></a>
カスタムドメイン名の相互 Transport Layer Security (TLS) 認証設定です。  
*タイプ*: [MutualTlsAuthentication](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-mutualtlsauthentication)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainName`リソースの `[MutualTlsAuthentication](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-mutualtlsauthentication)`プロパティに直接渡されます。

 `NormalizeBasePath`   <a name="sam-api-domainconfiguration-normalizebasepath"></a>
`BasePath` プロパティで定義されたベースパスに英数字以外の文字を使用できるかどうかを示します。`True` に設定すると、英数字以外の文字がベースパスから削除されます。  
`NormalizeBasePath` を `BasePath` プロパティと一緒に使用します。  
型: ブール  
*必須:* いいえ  
*デフォルト*: True  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `OwnershipVerificationCertificateArn`   <a name="sam-api-domainconfiguration-ownershipverificationcertificatearn"></a>
カスタムドメインの所有権を検証するために ACM によって発行されたパブリック証明書の ARN。相互 TLS を設定し、ACM にインポートされた、またはプライベート CA 証明書の ARN を `CertificateArn` に指定する場合のみ必須です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainName`リソースの `[OwnershipVerificationCertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-ownershipverificationcertificatearn)`プロパティに直接渡されます。

 `Policy`   <a name="sam-api-domainconfiguration-policy"></a>
API Gateway ドメイン名にアタッチする IAM ポリシー。`EndpointConfiguration` を `PRIVATE` に設定した場合にのみ該当します。  
型: Json  
*必須:* いいえ  
*CloudFormation 互換性*: `EndpointConfiguration`が に設定されている場合、このプロパティは `AWS::ApiGateway::DomainNameV2`リソースの `Policy`プロパティに直接渡されます`PRIVATE`。有効なポリシードキュメントの例については、「[AWS::ApiGateway::DomainNameV2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2)」を参照してください。

 `Route53`   <a name="sam-api-domainconfiguration-route53"></a>
Amazon Route 53 設定を定義します。  
*タイプ*: [Route53Configuration](sam-property-api-route53configuration.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `SecurityPolicy`   <a name="sam-api-domainconfiguration-securitypolicy"></a>
このドメイン名の TLS バージョンと暗号スイートです。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainName`リソースの `[SecurityPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-securitypolicy)`プロパティに直接渡されるか、 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnamev2)`EndpointConfiguration`が に設定されている場合に に渡されます`PRIVATE`。`PRIVATE` エンドポイントでは、TLS\$11\$12 のみがサポートされています。

## 例
<a name="sam-property-api-domainconfiguration--examples"></a>

### DomainName
<a name="sam-property-api-domainconfiguration--examples--domainname"></a>

DomainName の例

#### YAML
<a name="sam-property-api-domainconfiguration--examples--domainname--yaml"></a>

```
Domain:
  DomainName: www.example.com
  CertificateArn: arn-example
  EndpointConfiguration: EDGE
  Route53:
    HostedZoneId: Z1PA6795UKMFR9
  BasePath:
    - foo
    - bar
```

# DomainAccessAssociation
<a name="sam-property-api-domainaccessassociation"></a>

アクセス関連付けソースとプライベートカスタムドメイン名との間でドメインアクセスアソシエーションを設定します。サポートされているアクセス関連付けソースは VPC エンドポイント ID のみです。詳細については、「[API Gateway でのプライベート API のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。

## 構文
<a name="sam-property-api-domainaccessassociation-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-domainaccessassociation-syntax.yaml"></a>

```
 VpcEndpointId: String
```

## プロパティ
<a name="sam-property-api-domainaccessassociation-properties"></a>

 `VpcEndpointId`   <a name="sam-api-domainaccessassociation-vpcendpointid"></a>
API Gateway VPC サービスに関連付けられた VPC インターフェイスエンドポイントのエンドポイント ID。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::DomainNameAccessAssociation`リソースの `[ AccessAssociationSource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainnameaccessassociation.html#cfn-apigateway-domainnameaccessassociation-accessassociationsource)`プロパティに直接渡されます。

# Route53Configuration
<a name="sam-property-api-route53configuration"></a>

API の Route53 レコードセットを設定します。

## 構文
<a name="sam-property-api-route53configuration-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-route53configuration-syntax.yaml"></a>

```
  [DistributionDomainName](#sam-api-route53configuration-distributiondomainname): String
  [EvaluateTargetHealth](#sam-api-route53configuration-evaluatetargethealth): Boolean
  [HostedZoneId](#sam-api-route53configuration-hostedzoneid): String
  [HostedZoneName](#sam-api-route53configuration-hostedzonename): String
  [IpV6](#sam-api-route53configuration-ipv6): Boolean
  Region: String
  SetIdentifier: String
  VpcEndpointDomainName: String
  VpcEndpointHostedZoneId: String
```

## プロパティ
<a name="sam-property-api-route53configuration-properties"></a>

 `DistributionDomainName`   <a name="sam-api-route53configuration-distributiondomainname"></a>
API カスタムドメイン名のカスタムディストリビューションを設定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: API Gateway ディストリビューションを使用します。  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup AliasTarget`リソースの `[DNSName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget-1.html#cfn-route53-aliastarget-dnshostname)`プロパティに直接渡されます。  
*その他の注意点*: [CloudFront ディストリビューション](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html)のドメイン名です。

 `EvaluateTargetHealth`   <a name="sam-api-route53configuration-evaluatetargethealth"></a>
EvaluateTargetHealth が true の場合、エイリアスレコードは、Elastic Load Balancing ロードバランサーやホストゾーン内の別のレコードなど、参照される AWS リソースの正常性を継承します。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup AliasTarget`リソースの `[EvaluateTargetHealth](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html#cfn-route53-aliastarget-evaluatetargethealth)`プロパティに直接渡されます。  
*その他の注意点*: エイリアスターゲットが CloudFront ディストリビューションの場合は EvaluateTargetHealth を true に設定できません。

 `HostedZoneId`   <a name="sam-api-route53configuration-hostedzoneid"></a>
レコードを作成するホストゾーンの ID です。  
`HostedZoneName` または `HostedZoneId` を指定します。両方を指定することはできません。同じドメイン名のホストゾーンが複数ある場合は、`HostedZoneId` を使用してホストゾーンを指定する必要があります。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup RecordSet`リソースの `[HostedZoneId](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-1.html#cfn-route53-recordset-hostedzoneid)`プロパティに直接渡されます。

 `HostedZoneName`   <a name="sam-api-route53configuration-hostedzonename"></a>
レコードを作成するホストゾーンの名前です。  
`HostedZoneName` または `HostedZoneId` を指定します。両方を指定することはできません。同じドメイン名のホストゾーンが複数ある場合は、`HostedZoneId` を使用してホストゾーンを指定する必要があります。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup RecordSet`リソースの `[HostedZoneName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-1.html#cfn-route53-recordset-hostedzonename)`プロパティに直接渡されます。

 `IpV6`   <a name="sam-api-route53configuration-ipv6"></a>
このプロパティが設定されると、 は`AWS::Route53::RecordSet`リソース AWS SAM を作成し、指定された HostedZone [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html#cfn-route53-recordset-type) `AAAA` のタイプを に設定します。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。

`Region`  <a name="sam-api-route53configuration-region"></a>
*レイテンシーベースのリソースレコードセットのみ:* このリソースレコードセットが参照するリソースを作成した Amazon EC2 リージョン。リソースは通常、EC2 インスタンスや ELB ロードバランサーなどの AWS リソースであり、レコードタイプに応じて IP アドレスまたは DNS ドメイン名によって参照されます。  
レイテンシーリソースレコードセットが作成されているドメインの名前や種類を要求する DNS クエリを受け取ると、Amazon Route 53 は、エンドユーザーとそのユーザーに関連付けられている Amazon EC2 リージョンとの間でレイテンシーが最も小さいレイテンシーリソースレコードセットを選択します。その後、Route 53 は、選択したリソースレコードセットに関連付けられている値を返します。  
次の点に注意してください。  
+ レイテンシーリソースレコードセットごとに 1 つの `ResourceRecord` のみ指定できます。
+ 作成できるレイテンシーリソースレコードセットは、各 Amazon EC2 リージョンにつき 1 つだけです。
+ すべての Amazon EC2 リージョンに対してレイテンシーリソースレコードセットを作成する必要はありません。レイテンシーリソースレコードセットを作成したリージョンの中から、レイテンシーの最も小さいリージョンが Route 53 によって選択されます。
+ レイテンシーリソースレコードセットリソースと `Name` および `Type` 要素の値が同じである非レイテンシーリソースレコードセットを作成することはできません。
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup` `RecordSet` データ型の `[ Region](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-1.html#cfn-route53-recordset-region)`プロパティに直接渡されます。

`SetIdentifier`  <a name="sam-api-route53configuration-setidentifier"></a>
*シンプル以外のルーティングポリシーを持つリソースレコードセット:* タイプが A である acme.example.com という名前の複数の加重リソースレコードセットなど、名前とタイプの組み合わせが同じである複数のリソースレコードセットを区別する識別子。名前とタイプが同じであるリソースレコードセットのグループでは、リソースレコードセットごとに `SetIdentifier` の値が一意である必要があります。  
ルーティングポリシーの詳細については、「Amazon Route 53 デベロッパーガイド」の「[ルーティングポリシーの選択](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html)」を参照してください。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSetGroup` `RecordSet` データ型の `[ SetIdentifier](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-1.html#cfn-route53-recordset-setidentifier)`プロパティに直接渡されます。

`VpcEndpointDomainName`  <a name="sam-api-route53configuration-vpcendpointdomainname"></a>
API Gateway VPC サービスに関連付けられた VPC インターフェイスエンドポイントの DNS 名。このプロパティは、プライベートドメインにのみ必要です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSet``AliasTarget`フィールドの `[DNSName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-aliastarget.html)`プロパティに直接渡されます。

`VpcEndpointHostedZoneId`  <a name="sam-api-route53configuration-vpcendpointhostedzoneid"></a>
API Gateway VPC サービスに関連付けられた VPC インターフェイスエンドポイントのホストゾーン ID。このプロパティは、プライベートドメインにのみ必要です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::Route53::RecordSet``AliasTarget`フィールドの `[HostedZoneId](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset-aliastarget.html)`プロパティに直接渡されます。

## 例
<a name="sam-property-api-route53configuration--examples"></a>

### 基本的な の例
<a name="sam-property-api-route53configuration--examples--route-53-configuration-example"></a>

この例では、API 用にカスタムドメインと Route 53 のレコードセットを設定します。

#### YAML
<a name="sam-property-api-route53configuration--examples--route-53-configuration-example--yaml"></a>

```
Resources:
  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      Domain:
        DomainName: www.example.com
        CertificateArn: arn:aws:acm:us-east-1:123456789012:certificate/abcdef12-3456-7890-abcd-ef1234567890
        EndpointConfiguration: REGIONAL
        Route53:
          HostedZoneId: ABCDEFGHIJKLMNOP
```

# EndpointConfiguration
<a name="sam-property-api-endpointconfiguration"></a>

REST API のエンドポイントタイプです。

## 構文
<a name="sam-property-api-endpointconfiguration-syntax"></a>

 AWS Serverless Application Model (AWS SAM) テンプレートでこのエンティティを宣言するには、次の構文を使用します。

### YAML
<a name="sam-property-api-endpointconfiguration-syntax.yaml"></a>

```
  [IpAddressType](#sam-api-endpointconfiguration-ipaddresstype): String
  [Type](#sam-api-endpointconfiguration-type): String
  [VPCEndpointIds](#sam-api-endpointconfiguration-vpcendpointids): List
```

## プロパティ
<a name="sam-property-api-endpointconfiguration-properties"></a>

 `IpAddressType`   <a name="sam-api-endpointconfiguration-ipaddresstype"></a>
API (RestApi) を呼び出すことができる IP アドレスタイプ。  
*有効な値*: `ipv4` または `dualstack`  
タイプ：文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `EndpointConfiguration` データ型の `[IpAddressType](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html#cfn-apigateway-restapi-endpointconfiguration-ipaddresstype)`プロパティに直接渡されます。

 `Type`   <a name="sam-api-endpointconfiguration-type"></a>
REST API のエンドポイントタイプです。  
*有効な値*: `EDGE`、`REGIONAL`、または `PRIVATE`  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `EndpointConfiguration` データ型の `[Types](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html#cfn-apigateway-restapi-endpointconfiguration-types)`プロパティに直接渡されます。

 `VPCEndpointIds`   <a name="sam-api-endpointconfiguration-vpcendpointids"></a>
Route53 エイリアスを作成する REST API の VPC エンドポイント ID のリストです。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway::RestApi` `EndpointConfiguration` データ型の `[VpcEndpointIds](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html#cfn-apigateway-restapi-endpointconfiguration-vpcendpointids)`プロパティに直接渡されます。

## 例
<a name="sam-property-api-endpointconfiguration--examples"></a>

### EndpointConfiguration
<a name="sam-property-api-endpointconfiguration--examples--endpointconfiguration"></a>

エンドポイント設定の例

#### YAML
<a name="sam-property-api-endpointconfiguration--examples--endpointconfiguration--yaml"></a>

```
EndpointConfiguration:
  Type: PRIVATE
  VPCEndpointIds:
    - vpce-123a123a
    - vpce-321a321a
```