

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

# AWS::Serverless::HttpApi
<a name="sam-resource-httpapi"></a>

REST API よりもレイテンシーとコストが低い RESTful API を作成できる Amazon API Gateway HTTP API を作成します。詳細については、*API Gateway デベロッパーガイド*の「[HTTP API の操作](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html)」を参照してください。

 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-httpapi-syntax"></a>

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

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

```
Type: AWS::Serverless::HttpApi
Properties:
  [AccessLogSettings](#sam-httpapi-accesslogsettings): [AccessLogSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-accesslogsettings)
  [Auth](#sam-httpapi-auth): HttpApiAuth
  [CorsConfiguration](#sam-httpapi-corsconfiguration): String | HttpApiCorsConfiguration
  [DefaultRouteSettings](#sam-httpapi-defaultroutesettings): [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)
  [DefinitionBody](#sam-httpapi-definitionbody): JSON
  [DefinitionUri](#sam-httpapi-definitionuri): String | HttpApiDefinition
  [Description](#sam-httpapi-description): String
  [DisableExecuteApiEndpoint](#sam-httpapi-disableexecuteapiendpoint): Boolean
  [Domain](#sam-httpapi-domain): HttpApiDomainConfiguration
  [FailOnWarnings](#sam-httpapi-failonwarnings): Boolean
  Name: String
  PropagateTags: Boolean
  [RouteSettings](#sam-httpapi-routesettings): [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)
  [StageName](#sam-httpapi-stagename): String
  [StageVariables](#sam-httpapi-stagevariables): [Json](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-stagevariables)
  [Tags](#sam-httpapi-tags): Map
```

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

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

 `Auth`   <a name="sam-httpapi-auth"></a>
API Gateway HTTP API へのアクセスを制御するための認可を設定します。  
詳細については、*API Gateway デベロッパーガイド*の「[JWT オーソライザーを使用した HTTP API へのアクセスの制御](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html)」を参照してください。  
*タイプ*: [HttpApiAuth](sam-property-httpapi-httpapiauth.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `CorsConfiguration`   <a name="sam-httpapi-corsconfiguration"></a>
すべての API Gateway HTTP API のクロスオリジンリソース共有 (CORS) を管理します。文字列として許可するドメインを指定、または `HttpApiCorsConfiguration` オブジェクトを指定します。CORS では OpenAPI 定義を変更 AWS SAM する必要があるため、CORS は `DefinitionBody`プロパティが指定されている場合にのみ機能することに注意してください。  
詳細については、*API Gateway デベロッパーガイド*の「[HTTP API の CORS の設定](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html)」を参照してください。  
`CorsConfiguration` が OpenAPI 定義とプロパティレベルの両方で設定されている場合、 は両方の設定ソースをプロパティを優先して AWS SAM マージします。このプロパティが `true` に設定されている場合、すべてのオリジンが許可されます。
*タイプ*: 文字列 \$1 [HttpApiCorsConfiguration](sam-property-httpapi-httpapicorsconfiguration.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `DefaultRouteSettings`   <a name="sam-httpapi-defaultroutesettings"></a>
この HTTP API のデフォルトルート設定です。これらの設定は、特定のルートの `RouteSettings` プロパティによって上書きされる場合を除き、すべてのルートに適用されます。  
*Type*: [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Stage`リソースの `[RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)`プロパティに直接渡されます。

 `DefinitionBody`   <a name="sam-httpapi-definitionbody"></a>
HTTP API を説明する OpenAPI 定義です。`DefinitionUri` または を指定しない場合`DefinitionBody`、 はテンプレート設定に基づいて `DefinitionBody` AWS SAM を生成します。  
*Type*: JSON  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Api`リソースの `[Body](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html#cfn-apigatewayv2-api-body)`プロパティに似ています。特定のプロパティが指定されている場合、渡される`DefinitionBody`前に にコンテンツを挿入したり、 を変更 AWS SAM したりできます CloudFormation。プロパティには `Auth`、および対応する `AWS::Serverless::Function` のための HttpApi タイプの `EventSource` が含まれます。

 `DefinitionUri`   <a name="sam-httpapi-definitionuri"></a>
HTTP API を定義する OpenAPI 定義の Amazon Simple Storage Service (Amazon S3) URI、ローカルファイルパス、またはロケーションオブジェクトです。このプロパティが参照する Amazon S3 オブジェクトは、有効な OpenAPI 定義ファイルである必要があります。を指定しない場合、`DefinitionUri`または が指定されている場合、 `DefinitionBody`はテンプレート設定に基づいて `DefinitionBody` AWS SAM を生成します。  
ローカルファイルパスを指定する場合は、定義が適切に変換されるようにするために、テンプレートが `sam deploy` または `sam package` コマンドを含むワークフローを実行する必要があります。  
`DefinitionUri` を使用して参照する外部 OpenApi 定義ファイルでは、組み込み関数はサポートされていません。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` プロパティを使用します。  
*タイプ*: 文字列 \$1 [HttpApiDefinition](sam-property-httpapi-httpapidefinition.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Api`リソースの `[BodyS3Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html#cfn-apigatewayv2-api-bodys3location)`プロパティに似ています。ネストされた Amazon S3 プロパティには異なる名前が付けられています。

 `Description`   <a name="sam-httpapi-description"></a>
HTTP API リソースの説明です。  
を指定すると`Description`、 AWS SAM は `description`フィールドを設定して HTTP API リソースの OpenApi 定義を変更します。次のシナリオではエラーが発生します。  
+ `DefinitionBody` プロパティは、Open API 定義で設定された `description` フィールドで指定されます。これにより、解決 AWS SAM されない `description`フィールドの競合が発生します。
+ `DefinitionUri` プロパティが指定されています。Amazon AWS SAM S3 から取得される Open API 定義は変更されません。 Amazon S3
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

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

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

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

`Name`  <a name="sam-httpapi-name"></a>
HTTP API リソースの名前。  
を指定すると`Name`、 AWS SAM は `title`フィールドを設定して HTTP API リソースの OpenAPI 定義を変更します。次のシナリオではエラーが発生します。  
+ `DefinitionBody` プロパティは、Open API 定義で設定された `title` フィールドで指定されます。これにより、解決 AWS SAM されない `title`フィールドの競合が発生します。
+ `DefinitionUri` プロパティが指定されています。Amazon AWS SAM S3 から取得される Open API 定義は変更されません。 Amazon S3
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。

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

 `RouteSettings`   <a name="sam-httpapi-routesettings"></a>
この HTTP API に対するルートごとのルート設定です。詳細については、*API Gateway デベロッパーガイド*の「[HTTP API のルートの使用](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html)」を参照してください。  
*Type*: [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Stage`リソースの `[RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)`プロパティに直接渡されます。

 `StageName`   <a name="sam-httpapi-stagename"></a>
API ステージの名前です。名前が指定されていない場合、 は API Gateway の `$default`ステージ AWS SAM を使用します。  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: \$1default  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Stage`リソースの `[StageName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-stagename)`プロパティに直接渡されます。

 `StageVariables`   <a name="sam-httpapi-stagevariables"></a>
ステージ変数を定義するマップです。変数名には、英数字とアンダースコアを使用できます。値は [A-Za-z0-9-.\$1\$1:/?\$1&=,]\$1 に一致する必要があります。  
*タイプ*: [Json](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-stagevariables)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::Stage`リソースの `[StageVariables](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-stagevariables)`プロパティに直接渡されます。

 `Tags`   <a name="sam-httpapi-tags"></a>
この API Gateway ステージに追加するタグを指定するマップ (文字列対文字列) です。キーの長さは 1～128 文字の Unicode 文字で、プレフィックス `aws:` を含めることはできません。以下の文字を使用できます。一連の Unicode 文字、数字、空白、`_`、`.`、`/`、`=`、`+`、`-`。値は 1～256 文字の Unicode 文字にすることができます。  
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。  
*追加の注意*: `Tags`プロパティは OpenAPI 定義を変更する必要がある AWS SAM ため、タグは `DefinitionBody`プロパティが指定されている場合のみ追加されます。 `DefinitionUri` プロパティが指定されている場合、タグは追加されません。 は`httpapi:createdBy:SAM`タグ AWS SAM を自動的に追加します。タグは、`AWS::ApiGatewayV2::Stage` リソースと `AWS::ApiGatewayV2::DomainName` リソース (`DomainName` が指定されている場合) にも追加されます。

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

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

このリソースの論理 ID を `Ref` 組み込み関数に渡すと、`Ref` は基盤となる `AWS::ApiGatewayV2::Api` リソースの API ID (`a1bcdef2gh` など) を返します。

`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)」を参照してください。

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

### シンプルな HttpApi
<a name="sam-resource-httpapi--examples--simple-httpapi"></a>

以下の例は、Lambda 関数によってサポートされる HTTP API エンドポイントをセットアップするために必要な最小限の内容を示しています。この例では、 が AWS SAM 作成するデフォルトの HTTP API を使用します。

#### YAML
<a name="sam-resource-httpapi--examples--simple-httpapi--yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS SAM template with a simple API definition
Resources:
  ApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      Events:
        ApiEvent:
          Type: HttpApi
      Handler: index.handler
      InlineCode: |
        def handler(event, context):
            return {'body': 'Hello World!', 'statusCode': 200}
      Runtime: python3.7
Transform: AWS::Serverless-2016-10-31
```

### Auth を使用した HTTP API
<a name="sam-resource-httpapi--examples--httpapi-with-auth"></a>

以下の例は、API エンドポイントで認可をセットアップする方法を示しています。

#### YAML
<a name="sam-resource-httpapi--examples--httpapi-with-auth--yaml"></a>

```
Properties:
  FailOnWarnings: true
  Auth:
    DefaultAuthorizer: OAuth2
    Authorizers:
      OAuth2:
        AuthorizationScopes:
          - scope4
        JwtConfiguration:
          issuer: "https://www.example.com/v1/connect/oauth2"
          audience:
            - MyApi
        IdentitySource: "$request.querystring.param"
```

### OpenAPI 定義を使用した HttpAPI
<a name="sam-resource-httpapi--examples--httpapi-with-openapi-definition"></a>

以下の例は、テンプレートに OpenAPI 定義を追加する方法を示しています。

は、この HTTP API を参照する HttpApi イベントの欠落している Lambda 統合 AWS SAM をすべて埋めることに注意してください。 は、HttpApi イベントが参照する欠落しているパス AWS SAM も追加します。

#### YAML
<a name="sam-resource-httpapi--examples--httpapi-with-openapi-definition--yaml"></a>

```
Properties:
  FailOnWarnings: true
  DefinitionBody:
    info:
      version: '1.0'
      title:
        Ref: AWS::StackName
    paths:
      "/":
        get:
          security:
          - OpenIdAuth:
            - scope1
            - scope2
          responses: {}
    openapi: 3.0.1
    securitySchemes:
      OpenIdAuth:
        type: openIdConnect
        x-amazon-apigateway-authorizer:
          identitySource: "$request.querystring.param"
          type: jwt
          jwtConfiguration:
            audience:
            - MyApi
            issuer: https://www.example.com/v1/connect/oidc
          openIdConnectUrl: https://www.example.com/v1/connect/oidc/.well-known/openid-configuration
```

### 構成設定を使用した HttpApi
<a name="sam-resource-httpapi--examples--httpapi-with-configuration-settings"></a>

以下の例は、テンプレートに HTTP API とステージ構成を追加する方法を示しています。

#### YAML
<a name="sam-resource-httpapi--examples--httpapi-with-configuration-settings--yaml"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Parameters:
  StageName:
    Type: String
    Default: Prod
    
Resources:
  HttpApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      InlineCode: |
          def handler(event, context):
              import json
              return {
                  "statusCode": 200,
                  "body": json.dumps(event),
              }
      Handler: index.handler
      Runtime: python3.7
      Events:
        ExplicitApi: # warning: creates a public endpoint
          Type: HttpApi
          Properties:
            ApiId: !Ref HttpApi
            Method: GET
            Path: /path
            TimeoutInMillis: 15000
            PayloadFormatVersion: "2.0"
            RouteSettings:
              ThrottlingBurstLimit: 600

  HttpApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      StageName: !Ref StageName
      Tags:
        Tag: Value
      AccessLogSettings:
        DestinationArn: !GetAtt AccessLogs.Arn
        Format: $context.requestId
      DefaultRouteSettings:
        ThrottlingBurstLimit: 200
      RouteSettings:
        "GET /path":
          ThrottlingBurstLimit: 500 # overridden in HttpApi Event
      StageVariables:
        StageVar: Value
      FailOnWarnings: true

  AccessLogs:
    Type: AWS::Logs::LogGroup

Outputs:
  HttpApiUrl:
    Description: URL of your API endpoint
    Value:
      Fn::Sub: 'https://${HttpApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${StageName}/'
  HttpApiId:
    Description: Api id of HttpApi
    Value:
      Ref: HttpApi
```

# HttpApiAuth
<a name="sam-property-httpapi-httpapiauth"></a>

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

HTTP API へのアクセス権の設定に関する詳細については、*API Gateway デベロッパーガイド*の「[API Gateway での HTTP API へのアクセスの制御と管理](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-access-control.html)」を参照してください。

## 構文
<a name="sam-property-httpapi-httpapiauth-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-httpapiauth-syntax.yaml"></a>

```
  [Authorizers](#sam-httpapi-httpapiauth-authorizers): OAuth2Authorizer | LambdaAuthorizer
  [DefaultAuthorizer](#sam-httpapi-httpapiauth-defaultauthorizer): String
  [EnableIamAuthorizer](#sam-httpapi-httpapiauth-enableiamauthorizer): Boolean
```

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

 `Authorizers`   <a name="sam-httpapi-httpapiauth-authorizers"></a>
API Gateway API へのアクセスを制御するために使用されるオーソライザーです。  
*タイプ*: [OAuth2Authorizer](sam-property-httpapi-oauth2authorizer.md) \$1 [LambdaAuthorizer](sam-property-httpapi-lambdaauthorizer.md)  
*必須:* いいえ  
*デフォルト*: なし  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。  
*その他の注意事項*: OpenAPI 定義にオーソライザー AWS SAM を追加します。

 `DefaultAuthorizer`   <a name="sam-httpapi-httpapiauth-defaultauthorizer"></a>
API Gateway API に対する API コールの認証に使用するデフォルトのオーソライザーを指定します。`EnableIamAuthorizer` が `true` に設定されている場合、`AWS_IAM` をデフォルトの承認者として指定できます。それ以外の場合は、`Authorizers` で定義した承認者を指定します。  
*タイプ*: 文字列  
*必須:* いいえ  
*デフォルト*: なし  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `EnableIamAuthorizer`   <a name="sam-httpapi-httpapiauth-enableiamauthorizer"></a>
API ルートに IAM 認可を使用するかどうかを指定します。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-httpapi-httpapiauth--examples"></a>

### OAuth 2.0 オーソライザー
<a name="sam-property-httpapi-httpapiauth--examples--oauth-2.0-authorizer"></a>

OAuth 2.0 オーソライザーの例

#### YAML
<a name="sam-property-httpapi-httpapiauth--examples--oauth-2.0-authorizer--yaml"></a>

```
Auth:
  Authorizers:
    OAuth2Authorizer:
      AuthorizationScopes:
        - scope1
        - scope2
      JwtConfiguration:
        issuer: "https://www.example.com/v1/connect/oauth2"
        audience:
          - MyApi
      IdentitySource: "$request.querystring.param"
  DefaultAuthorizer: OAuth2Authorizer
```

### IAM 承認者
<a name="sam-property-httpapi-httpapiauth--examples--iam-authorizer"></a>

IAM 承認者の例

#### YAML
<a name="sam-property-httpapi-httpapiauth--examples--iam-authorizer--yaml"></a>

```
Auth:
  EnableIamAuthorizer: true
  DefaultAuthorizer: AWS_IAM
```

# LambdaAuthorizer
<a name="sam-property-httpapi-lambdaauthorizer"></a>

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

詳細と例については、*API Gateway デベロッパーガイド*の[「HTTP API の AWS Lambda オーソライザーの使用 APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html)」を参照してください。

## 構文
<a name="sam-property-httpapi-lambdaauthorizer-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-lambdaauthorizer-syntax.yaml"></a>

```
  [AuthorizerPayloadFormatVersion](#sam-httpapi-lambdaauthorizer-authorizerpayloadformatversion): String
  EnableFunctionDefaultPermissions: Boolean
  [EnableSimpleResponses](#sam-httpapi-lambdaauthorizer-enablesimpleresponses): Boolean
  [FunctionArn](#sam-httpapi-lambdaauthorizer-functionarn): String
  [FunctionInvokeRole](#sam-httpapi-lambdaauthorizer-functioninvokerole): String
  [Identity](#sam-httpapi-lambdaauthorizer-identity): LambdaAuthorizationIdentity
```

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

 `AuthorizerPayloadFormatVersion`   <a name="sam-httpapi-lambdaauthorizer-authorizerpayloadformatversion"></a>
HTTP API Lambda オーソライザーに送信されるペイロードの形式を指定します。HTTP API Lambda オーソライザーに必要です。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `authorizerPayloadFormatVersion` セクションに渡されます。  
*有効な値*: `1.0` または `2.0`  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `EnableFunctionDefaultPermissions`   <a name="sam-httpapi-lambdaauthorizer-enablefunctiondefaultpermissions"></a>
デフォルトでは、HTTP API リソースには Lambda オーソライザーを呼び出すための許可が付与されていません。HTTP API リソースと Lambda オーソライザーの間の許可を自動的に作成するには、このプロパティを `true` として指定します。  
型: ブール  
*必須:* いいえ  
*デフォルト値*: `false`  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、同等の CloudFormation ものはありません。

 `EnableSimpleResponses`   <a name="sam-httpapi-lambdaauthorizer-enablesimpleresponses"></a>
Lambda オーソライザーがシンプルな形式でレスポンスを返すかどうかを指定します。デフォルトでは、Lambda オーソライザーは AWS Identity and Access Management (IAM) ポリシーを返す必要があります。有効にした場合、Lambda オーソライザーは IAM ポリシーの代わりにブール値を返すことができます。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `enableSimpleResponses` セクションに渡されます。  
型: ブール  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionArn`   <a name="sam-httpapi-lambdaauthorizer-functionarn"></a>
API の認可を提供する Lambda 関数の Amazon リソースネーム (ARN) です。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `authorizerUri` セクションに渡されます。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `FunctionInvokeRole`   <a name="sam-httpapi-lambdaauthorizer-functioninvokerole"></a>
API Gateway がオーソライザー関数を呼び出すために必要な認証情報を持つ IAM ロールの ARN です。このパラメータは、関数のリソースベースのポリシーが API Gateway に `lambda:InvokeFunction` 許可を付与しない場合に指定します。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `authorizerCredentials` セクションに渡されます。  
詳細については、*API Gateway デベロッパーガイド*の「[Lambda オーソライザーの作成](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html#http-api-lambda-authorizer.example-create)」を参照してください。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のプロパティはありません。

 `Identity`   <a name="sam-httpapi-lambdaauthorizer-identity"></a>
オーソライザーの受信リクエストに `IdentitySource` を指定します。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `identitySource` セクションに渡されます。  
*タイプ*: [LambdaAuthorizationIdentity](sam-property-httpapi-lambdaauthorizationidentity.md)  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-httpapi-lambdaauthorizer--examples"></a>

### LambdaAuthorizer
<a name="sam-property-httpapi-lambdaauthorizer--examples--lambdaauthorizer"></a>

LambdaAuthorizer の例

#### YAML
<a name="sam-property-httpapi-lambdaauthorizer--examples--lambdaauthorizer--yaml"></a>

```
Auth:
  Authorizers:
    MyLambdaAuthorizer:
      AuthorizerPayloadFormatVersion: 2.0
      FunctionArn:
        Fn::GetAtt:
          - MyAuthFunction
          - Arn
      FunctionInvokeRole:
        Fn::GetAtt:
          - LambdaAuthInvokeRole
          - Arn
      Identity:
        Headers:
          - Authorization
```

# LambdaAuthorizationIdentity
<a name="sam-property-httpapi-lambdaauthorizationidentity"></a>

このプロパティは、Lambda オーソライザーの受信リクエストに IdentitySource を指定するために使用できます。アイデンティティソースの詳細については、*API Gateway デベロッパーガイド*の「[ID ソース](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html#http-api-lambda-authorizer.identity-sources)」を参照してください。

## 構文
<a name="sam-property-httpapi-lambdaauthorizationidentity-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-lambdaauthorizationidentity-syntax.yaml"></a>

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

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

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

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

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

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

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

## 例
<a name="sam-property-httpapi-lambdaauthorizationidentity--examples"></a>

### LambdaRequestIdentity
<a name="sam-property-httpapi-lambdaauthorizationidentity--examples--lambdarequestidentity"></a>

Lambda リクエストアイデンティティの例

#### YAML
<a name="sam-property-httpapi-lambdaauthorizationidentity--examples--lambdarequestidentity--yaml"></a>

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

# OAuth2Authorizer
<a name="sam-property-httpapi-oauth2authorizer"></a>

JSON Web トークン (JWT) オーソライザーとしても知られる OAuth 2.0 オーソライザーの定義です。

詳細については、*API Gateway デベロッパーガイド*の「[JWT オーソライザーを使用した HTTP API へのアクセスの制御](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html)」を参照してください。

## 構文
<a name="sam-property-httpapi-oauth2authorizer-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-oauth2authorizer-syntax.yaml"></a>

```
  [AuthorizationScopes](#sam-httpapi-oauth2authorizer-authorizationscopes): List
  [IdentitySource](#sam-httpapi-oauth2authorizer-identitysource): String
  [JwtConfiguration](#sam-httpapi-oauth2authorizer-jwtconfiguration): Map
```

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

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

 `IdentitySource`   <a name="sam-httpapi-oauth2authorizer-identitysource"></a>
このオーソライザーのアイデンティティソース式です。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `JwtConfiguration`   <a name="sam-httpapi-oauth2authorizer-jwtconfiguration"></a>
このオーソライザーの JWT 設定です。  
これは、OpenAPI 定義の `securitySchemes` セクションにある `x-amazon-apigateway-authorizer` の `jwtConfiguration` セクションに渡されます。  
プロパティ `issuer` と `audience` は大文字と小文字を区別せず、OpenAPI のように小文字を使用することも、[ AWS::ApiGatewayV2::Authorizer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-authorizer-jwtconfiguration.html) のように大文字の `Issuer` および `Audience` を使用することもできます。
*タイプ*: マップ  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

## 例
<a name="sam-property-httpapi-oauth2authorizer--examples"></a>

### OAuth 2.0 オーソライザー
<a name="sam-property-httpapi-oauth2authorizer--examples--oauth-2.0-authorizer"></a>

OAuth 2.0 オーソライザーの例

#### YAML
<a name="sam-property-httpapi-oauth2authorizer--examples--oauth-2.0-authorizer--yaml"></a>

```
Auth:
  Authorizers:
    OAuth2Authorizer:
      AuthorizationScopes:
        - scope1
      JwtConfiguration:
        issuer: "https://www.example.com/v1/connect/oauth2"
        audience:
          - MyApi
      IdentitySource: "$request.querystring.param"
  DefaultAuthorizer: OAuth2Authorizer
```

# HttpApiCorsConfiguration
<a name="sam-property-httpapi-httpapicorsconfiguration"></a>

HTTP API のクロスオリジンリソース共有 (CORS) を管理します。許可するドメインを文字列として指定するか、追加の CORS 設定でディクショナリを指定します。注意: CORS では OpenAPI 定義の変更に SAM が必要となるため、これが機能するのは `DefinitionBody` で Inline OpenApi が定義されている場合のみです。

CORS の詳細については、*API Gateway デベロッパーガイド*の「[HTTP API の CORS の設定](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html)」を参照してください。

注: HttpApiCorsConfiguration が OpenAPI とプロパティレベルの両方で設定されている場合、 はそれらのプロパティを優先して AWS SAM マージします。

## 構文
<a name="sam-property-httpapi-httpapicorsconfiguration-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-httpapicorsconfiguration-syntax.yaml"></a>

```
  [AllowCredentials](#sam-httpapi-httpapicorsconfiguration-allowcredentials): Boolean
  [AllowHeaders](#sam-httpapi-httpapicorsconfiguration-allowheaders): List
  [AllowMethods](#sam-httpapi-httpapicorsconfiguration-allowmethods): List
  [AllowOrigins](#sam-httpapi-httpapicorsconfiguration-alloworigins): List
  [ExposeHeaders](#sam-httpapi-httpapicorsconfiguration-exposeheaders): List
  [MaxAge](#sam-httpapi-httpapicorsconfiguration-maxage): Integer
```

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

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

 `AllowHeaders`   <a name="sam-httpapi-httpapicorsconfiguration-allowheaders"></a>
許可されるヘッダーのコレクションを表します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AllowMethods`   <a name="sam-httpapi-httpapicorsconfiguration-allowmethods"></a>
許可される HTTP メソッドのコレクションを表します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `AllowOrigins`   <a name="sam-httpapi-httpapicorsconfiguration-alloworigins"></a>
許可されたオリジンのコレクションを表します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

 `ExposeHeaders`   <a name="sam-httpapi-httpapicorsconfiguration-exposeheaders"></a>
公開されたヘッダーのコレクションを表します。  
*タイプ*: リスト  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは に固有 AWS SAM であり、 CloudFormation 同等のものはありません。

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

## 例
<a name="sam-property-httpapi-httpapicorsconfiguration--examples"></a>

### HttpApiCorsConfiguration
<a name="sam-property-httpapi-httpapicorsconfiguration--examples--httpapicorsconfiguration"></a>

HTTP API Cors 設定の例です。

#### YAML
<a name="sam-property-httpapi-httpapicorsconfiguration--examples--httpapicorsconfiguration--yaml"></a>

```
CorsConfiguration:
  AllowOrigins:
    - "https://example.com"
  AllowHeaders:
    - x-apigateway-header
  AllowMethods:
    - GET
  MaxAge: 600
  AllowCredentials: true
```

# HttpApiDefinition
<a name="sam-property-httpapi-httpapidefinition"></a>

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

## 構文
<a name="sam-property-httpapi-httpapidefinition-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-httpapidefinition-syntax.yaml"></a>

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

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

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

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

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

## 例
<a name="sam-property-httpapi-httpapidefinition--examples"></a>

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

API 定義の例

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

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

# HttpApiDomainConfiguration
<a name="sam-property-httpapi-httpapidomainconfiguration"></a>

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

## 構文
<a name="sam-property-httpapi-httpapidomainconfiguration-syntax"></a>

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

### YAML
<a name="sam-property-httpapi-httpapidomainconfiguration-syntax.yaml"></a>

```
  [BasePath](#sam-httpapi-httpapidomainconfiguration-basepath): List
  [CertificateArn](#sam-httpapi-httpapidomainconfiguration-certificatearn): String
  [DomainName](#sam-httpapi-httpapidomainconfiguration-domainname): String
  [EndpointConfiguration](#sam-httpapi-httpapidomainconfiguration-endpointconfiguration): String
  [MutualTlsAuthentication](#sam-httpapi-httpapidomainconfiguration-mutualtlsauthentication): [MutualTlsAuthentication](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-domainname.html#cfn-apigatewayv2-domainname-mutualtlsauthentication)
  [OwnershipVerificationCertificateArn](#sam-httpapi-httpapidomainconfiguration-ownershipverificationcertificatearn): String
  [Route53](#sam-httpapi-httpapidomainconfiguration-route53): Route53Configuration
  [SecurityPolicy](#sam-httpapi-httpapidomainconfiguration-securitypolicy): String
```

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

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

 `CertificateArn`   <a name="sam-httpapi-httpapidomainconfiguration-certificatearn"></a>
このドメイン名のエンドポイントの AWS マネージド証明書の Amazon リソースネーム (ARN)。 は、サポートされている唯一のソース AWS Certificate Manager です。  
*タイプ*: 文字列  
*必須*: はい  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGateway2::DomainName DomainNameConfiguration`リソースの `[CertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html#cfn-apigatewayv2-domainname-domainnameconfiguration-certificatearn)`プロパティに直接渡されます。

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

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

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

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

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

 `SecurityPolicy`   <a name="sam-httpapi-httpapidomainconfiguration-securitypolicy"></a>
このドメイン名に対するセキュリティポリシーの TLS バージョンです。  
HTTP API に有効な値は `TLS_1_2` のみです。  
*タイプ*: 文字列  
*必須:* いいえ  
*CloudFormation 互換性*: このプロパティは、 `AWS::ApiGatewayV2::DomainName` `DomainNameConfiguration` データ型の `[SecurityPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html#cfn-apigatewayv2-domainname-domainnameconfiguration-securitypolicy)`プロパティに直接渡されます。

## 例
<a name="sam-property-httpapi-httpapidomainconfiguration--examples"></a>

### DomainName
<a name="sam-property-httpapi-httpapidomainconfiguration--examples--domainname"></a>

DomainName の例

#### YAML
<a name="sam-property-httpapi-httpapidomainconfiguration--examples--domainname--yaml"></a>

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

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

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

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

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

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

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

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

 `DistributionDomainName`   <a name="sam-httpapi-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-httpapi-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-httpapi-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-httpapi-route53configuration-hostedzonename"></a>
レコードを作成するホストゾーンの名前です。`HostedZoneName` の一部には、末尾のドット (`www.example.com.` など) を含める必要があります。  
`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-httpapi-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-httpapi-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-httpapi-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)`プロパティに直接渡されます。

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

### Route 53 設定の例
<a name="sam-property-httpapi-route53configuration--examples--route-53-configuration-example"></a>

この例は、Route 53 の設定方法を示しています。

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

```
Domain:
  DomainName: www.example.com
  CertificateArn: arn-example
  EndpointConfiguration: EDGE
  Route53:
    HostedZoneId: Z1PA6795UKMFR9
    EvaluateTargetHealth: true
    DistributionDomainName: xyz
```