

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 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
```

## Properties
<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 域名配置的基本路径列表。  
*类型*：列表  
*必需*：否  
*默认值*：/  
*CloudFormation 兼容性*：此属性类似于`AWS::ApiGateway::BasePathMapping`资源的`[BasePath](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-basepathmapping.html#cfn-apigateway-basepathmapping-basepath)`属性。 AWS SAM 创建多个`AWS::ApiGateway::BasePathMapping`资源，每个资源在此属性中`BasePath`指定一个。

 `CertificateArn`   <a name="sam-api-domainconfiguration-certificatearn"></a>
 AWS 托管证书的亚马逊资源名称 (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`映射到 [RegionalCertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-regionalcertificatearn)in `AWS::ApiGateway::DomainName`。如果设置`EndpointConfiguration`为`EDGE`，则`CertificateArn`映射到 [CertificateArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-certificatearn)in `AWS::ApiGateway::DomainName`。如果设置`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)`属性，或者在设置为[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`。

 `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>
自定义域名的相互传输层安全性协议（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`，则将从基本路径中移除非字母数字字符。  
针对 `BasePath` 属性使用 `NormalizeBasePath`。  
*类型*：布尔值  
*必需*：否  
*默认值*：True  
*CloudFormation 兼容性*：此属性是独有的 AWS SAM ，没有 CloudFormation 等效属性。

 `OwnershipVerificationCertificateArn`   <a name="sam-api-domainconfiguration-ownershipverificationcertificatearn"></a>
ACM 颁发的用于验证自定义域所有权的公有证书的 ARN。只有在配置双向 TLS 并且为 `CertificateArn` 指定了 ACM 导入的或私有 CA 证书 ARN 时才需要。  
*类型*：字符串  
*必需*：否  
*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>
要附加到该 AP Gateway 域名的 IAM 策略。仅当 `EndpointConfiguration` 设置为 `PRIVATE` 时适用。  
*类型*：Json  
*必需*：否  
*CloudFormation 兼容性*：当设置为时`EndpointConfiguration`，此`Policy`属性将直接传递给`AWS::ApiGateway::DomainNameV2`资源的属性`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
```