

# Amazon API Gateway 配额
<a name="limits"></a>

以下配额适用于所有 Amazon API Gateway API 类型。

## API Gateway 账户级别配额，每个区域
<a name="apigateway-account-level-limits-table"></a>

以下配额按 Amazon API Gateway 中的每个账户、每个区域应用。


| 资源或操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| 跨 HTTP API、REST API、WebSocket API 和 WebSocket 回调 API 的每账户、每区域的限制配额 | 每秒 10000 个请求 (RPS)，额外的突增容量由[令牌存储桶算法](https://en.wikipedia.org/wiki/Token_bucket)提供，使用的最大存储桶容量为 5000 个请求。\$1 突增配额由 API Gateway 服务团队根据区域中账户的总体 RPS 配额确定。它不是客户可以控制或请求更改的配额。  | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-8A5B8E43) | 
| 限制门户每个区域每个账户的配额，无访问控制 | 每秒 250,000 个请求 | 否 | 
| 限制门户每个区域每个账户的配额，有访问控制 | 每秒 10,000 个请求 | 否 | 

\$1 对于以下区域，默认节流配额为 2500 RPS，而默认爆增配额为 1250 RPS：非洲（开普敦）、欧洲地区（米兰）、亚太地区（雅加达）、中东（阿联酋）、亚太地区（海得拉巴）、亚太地区（墨尔本）、欧洲（西班牙）、欧洲（苏黎世）、以色列（特拉维夫）、加拿大西部（卡尔加里）、亚太地区（马来西亚）、亚太地区（泰国）和墨西哥（中部）。

## API Gateway 在创建、部署和管理 API 方面的配额
<a name="api-gateway-control-service-limits-table"></a>

以下固定配额适用于使用 AWS CLI、API Gateway 控制台或 API Gateway REST API 及其开发工具包在 API Gateway 中创建、部署和管理 API。这些配额不能提高。


| 操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| [CreateApiKey](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateApiKey.html) | 每账户每秒 5 个请求 | 否 | 
| [CreateDeployment](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateDeployment.html) | 每账户每 5 秒 1 个请求 | 否 | 
| [CreateDocumentationVersion](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateDocumentationVersion.html) | 每账户每 20 秒 1 个请求 | 否 | 
| [CreateDomainName](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateDomainName.html) | 每账户每 30 秒 1 个请求 | 否 | 
| [CreateResource](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateResource.html) | 每账户每秒 5 个请求 | 否 | 
| [CreateRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateRestApi.html)（适用于区域或私有 API） | 每账户每 3 秒 1 个请求 | 否 | 
| [CreateRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_CreateRestApi.html)（适用于边缘优化 API） | 每账户每 30 秒 1 个请求 | 否 | 
|  [CreateVpcLink](https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/vpclinks.html#CreateVpcLink) (V2)  | 每账户每 15 秒 1 个请求 | 否 | 
| [DeleteApiKey](https://docs.aws.amazon.com/apigateway/latest/api/API_DeleteApiKey.html) | 每账户每秒 5 个请求 | 否 | 
| [DeleteDomainName](https://docs.aws.amazon.com/apigateway/latest/api/API_DeleteDomainName.html) | 每账户每 30 秒 1 个请求 | 否 | 
| [DeleteResource](https://docs.aws.amazon.com/apigateway/latest/api/API_DeleteResource.html) | 每账户每秒 5 个请求 | 否 | 
| [DeleteRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_DeleteRestApi.html) | 每账户每 30 秒 1 个请求 | 否 | 
| [GetResources](https://docs.aws.amazon.com/apigateway/latest/api/API_GetResources.html) | 每账户每 2 秒 5 个请求 | 否 | 
|  [DeleteVpcLink](https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/vpclinks.html#DeleteVpcLink) (V2)  | 每账户每 30 秒 1 个请求 | 否 | 
| [ImportDocumentationParts](https://docs.aws.amazon.com/apigateway/latest/api/API_ImportDocumentationParts.html) | 每账户每 30 秒 1 个请求 | 否 | 
| [ImportRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_ImportRestApi.html)（适用于区域或私有 API） | 每账户每 3 秒 1 个请求 | 否 | 
| [ImportRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_ImportRestApi.html)（适用于边缘优化 API）  | 每账户每 30 秒 1 个请求 | 否 | 
| [PutRestApi](https://docs.aws.amazon.com/apigateway/latest/api/API_PutRestApi.html) | 每账户每秒 1 个请求 | 否 | 
| [UpdateAccount](https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateAccount.html) | 每账户每 20 秒 1 个请求 | 否 | 
| [UpdateDomainName](https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateDomainName.html) | 每账户每 30 秒 1 个请求 | 否 | 
| [UpdateUsagePlan](https://docs.aws.amazon.com/apigateway/latest/api/API_UpdateUsagePlan.html) | 每账户每 20 秒 1 个请求 | 否 | 
| 创建门户 | 每 3 秒 1 个请求 | 否 | 
| 更新门户 | 每分钟 2 个请求 | 否 | 
| 获取门户 | 每秒 10 个请求 | 否 | 
| 列出门户 | 每秒 10 个请求 | 否 | 
| 发布门户 | 每分钟 2 个请求 | 否 | 
| DeletePortal | 每分钟 2 个请求 | 否 | 
| PreviewPortal | 每 3 秒 1 个请求 | 否 | 
| DisablePortal | 每分钟 2 个请求 | 否 | 
| GetPortalProduct | 每秒 10 个请求 | 否 | 
| ListPortalProduct | 每秒 5 个请求 | 否 | 
| CreatePortalProduct | 每秒 2 个请求 | 否 | 
| UpdatePortalProduct | 每秒 0.5 个请求 | 否 | 
| DeletePortalProduct | 每秒 1 个请求 | 否 | 
| PutPortalProductSharingPolicy | 每 3 秒 1 个请求 | 否 | 
| GetPortalProductSharingPolicy | 每秒 10 个请求 | 否 | 
| DeletePortalProductSharingPolicy | 每 3 秒 1 个请求 | 否 | 
| CreateProductRestEndpointPage | 每 3 秒 1 个请求 | 否 | 
| GetProductRestEndpointPage | 每秒 10 个请求 | 否 | 
| UpdateProductRestEndpointPage | 每 3 秒 1 个请求 | 否 | 
| DeleteProductRestEndpointPage | 每 3 秒 1 个请求 | 否 | 
| ListProductRestEndpointPages | 每秒 10 个请求 | 否 | 
| CreateProductPage | 每 3 秒 1 个请求 | 否 | 
| GetProductPage | 每秒 10 个请求 | 否 | 
| UpdateProductPage | 每 3 秒 1 个请求 | 否 | 
| DeleteProductPage | 每 3 秒 1 个请求 | 否 | 
| ListProductPages | 每秒 10 个请求 | 否 | 
| 其他操作 | 无配额到不超过账户总配额。 | 否 | 
| 总操作 | 每秒 10 个请求，突增配额为每秒 40 个请求。 | 否 | 

# API Gateway 中用于配置和运行 REST API 的配额
<a name="api-gateway-execution-service-limits-table"></a>

在 Amazon API Gateway 中配置和运行 REST API 时适用以下配额。如果配额是按 API 分配的，则只能对特定的 API 增加配额，而不能对账户中的所有 API 增加配额。

有关账户级别配额的信息，请参阅[Amazon API Gateway 配额](limits.md)。


| 资源或操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| 每个区域每个账户的公共自定义域名数 | 120 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-A93447B8)。 | 
| 每个区域每个账户的私有自定义域名数 | 50 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-24E7E662) | 
| 每区域的区域 API | 600 | 否 | 
| 每区域的边缘优化 API | 120 | 否 | 
| 每个区域每个账户的私有 API 数 | 600 | 否 | 
| 每个账户的域名访问关联数 | 100 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-4D98A8A5) | 
| 每个域的多级 API 映射 | 200 | 否 | 
| 每个域的路由规则数 | 50 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-68B79FF0) | 
| 以字符数表示的边缘优化 API 的 URL 长度 | 8192 | 否 | 
| 以字符数表示的区域 API 的 URL 长度 | 10240 | 否 | 
| 以字符数表示的私有 API 的 URL 长度 | 8192 | 否 | 
| API Gateway 资源策略的字符长度 | 8192 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-8B81B02C)。 | 
| 每区域每账户的 API 密钥数 | 10000 | 否 | 
| 每区域每账户的客户端证书数 | 60 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-824C9E42)。 | 
| 每个 API 的授权方（AWS Lambda 和 Amazon Cognito） | 10 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| 每个 API 的文档部分 | 2000 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| 每个 API 的资源 | 300 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-01C8A9E0)。 | 
| 每个 API 的阶段 | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-379E48B0) | 
| 每个阶段的阶段变量 | 100 | 否 | 
| 阶段变量中以字符数表示的键长度 | 64 | 否 | 
| 阶段变量中以字符数表示的值长度 | 512 | 否 | 
| 每区域每账户的使用计划数 | 300 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-E8693075)。 | 
| 每个 API 密钥的使用计划 | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-985EB478) | 
| 每区域每账户的 VPC 链接数 | 20 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-A4C7274F) | 
| API 缓存 TTL | 默认情况下为 300 秒，可由 API 所有者配置为 0 到 3600 秒之间。 | 上限 (3600) 处不可增加 | 
| 缓存响应大小 | 1048576 字节。缓存数据加密可能会增加正在缓存的项目的大小。 | 否 | 
| 区域 API 的集成超时 | 50 毫秒 - 对于所有集成类型（包括 Lambda、Lambda 代理、HTTP、HTTP 代理和AWS集成）均为 29 秒。 | [是\$1](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-E5AE38E3) | 
| 边缘优化 API 的集成超时 | 50 毫秒 - 对于所有集成类型（包括 Lambda、Lambda 代理、HTTP、HTTP 代理和AWS集成）均为 29 秒。 | 否 | 
| 私有 API 的集成超时 | 50 毫秒 - 对于所有集成类型（包括 Lambda、Lambda 代理、HTTP、HTTP 代理和AWS集成）均为 29 秒。 | [是 \$1](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-E5AE38E3) | 
| 所有标头值的总组合大小，包括标头名称、值、任何行终止符和空格 | 10240 字节 | 否 | 
| 私有 API 的所有标头值的总组合大小 | 8000 字节 | 否 | 
| 负载大小 | 10 MB | 否 | 
| 每阶段的标签数 | 50 | 否 | 
| 映射模板的 \$1foreach ... \$1end 循环中迭代的数量 | 1000 | 否 | 
| 最大映射模板大小 | 300KB | 否 | 
| 访问日志模板大小 | 3 KB | 否 | 
| 方法 ARN 长度 | 1600 字节。如果您的方法包含路径参数，而客户端使用的值超过 ARN 长度，则 API 将返回 414 Request URI too long 响应。 | 否 | 
| 使用计划中某个阶段方法一级的节流设置 | 20 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| 每个 API 的模型大小 | 400KB | 否 | 
| 信任存储中的证书数量 | 1000 个证书，对象总大小不超过 1 MB。 | 否 | 
| 空闲连接超时 | 310 秒 | 否 | 
| 使用 [restapi:import](https://docs.aws.amazon.com/apigateway/latest/api/API_ImportRestApi.html) 或 [restapi:put](https://docs.aws.amazon.com/apigateway/latest/api/API_PutRestApi.html) 时的最大 API 定义文件大小 | 6 MB | 否 | 

\$1 您不能将集成超时设置为小于 50 毫秒。可以将集成超时提高到 29 秒以上，但这可能需要降低账户的区域级节流配额。

## 减少配额的最佳实践
<a name="api-gateway-execution-service-limits-best-practices"></a>

以下最佳实践可能有助于减少您当前的资源数量，从而避免增加配额。请确保这些建议适用于您的 API 架构。

**每区域的 API 数**  
要减少每区域的 API 数量，请导出所有未使用的 API，然后将其从 API Gateway 中删除。有关更多信息，请参阅 [从 API Gateway 导出 REST API](api-gateway-export-api.md)。

**每个 API 的阶段**  
要减少每个 API 的阶段数，请将您的 API 拆分为多个 API。

**每个 API 的资源**  
使用 `{proxy+}` 路径来减少资源数。有关更多信息，请参阅 [设置具有代理资源的代理集成](api-gateway-set-up-simple-proxy.md)。

**API 映射**  
要减少自定义域名的 API 映射数量，请使用具有单个级别的 API 映射，例如 `/prod`。具有单个级别的 API 映射不计入 API 映射配额。

**每个 API 的授权方**  
要减少每个 API 的授权方数量，请跨 API 方法重用授权方。

**每个 API 的文档部分**  
要减少每个 API 的文档部分数量，请在导入 API 时使用 `ignore=documentation`。有关更多信息，请参阅 [导入 API 文档](api-gateway-documenting-api-quick-start-import-export.md)。  
还可以使用内容继承，来支持某些文档部分从更通用规范的 API 实体继承内容。有关更多信息，请参阅 [API 文档在 API Gateway 中的表示形式](api-gateway-documenting-api-content-representation.md)。

**API Gateway 资源策略的字符长度**  
要减少资源策略的长度，请使用 AWS WAFV2 来保护您的 API。有关更多信息，请参阅 [在 API Gateway 中使用 AWS WAF 保护 REST API](apigateway-control-access-aws-waf.md)。  
如果您的策略包含 IP 地址，也可以使用范围而不是特定值来定义 IP 地址。

**每个 API 密钥的使用计划**  
要减少每个 API 密钥的使用计划数量，请为每个使用计划使用一个 API 密钥，并将使用计划与多个 API 关联。建议不要在多个使用计划间共享一个 API 密钥。

# API Gateway 中用于配置和运行 HTTP API 的配额
<a name="http-api-quotas"></a>

以下配额适用于在 Amazon API Gateway 中配置和运行 HTTP API。如果配额是按 API 分配的，则只能对特定的 API 增加配额，而不能对账户中的所有 API 增加配额。有关账户级别配额的信息，请参阅[Amazon API Gateway 配额](limits.md)


| 资源或操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| 每 API 的路由数 | 300 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-01C8A9E0)。 | 
| 每 API 的集成数 | 300 | 否 | 
| 最大集成超时 | 30 秒 | 否 | 
| 每个 API 的阶段 | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-379E48B0) | 
| 每个域的多级 API 映射 | 200 个 API 映射。此限制不包括单级的 API 映射，例如 /prod。 | 否 | 
| 每阶段的标签数  | 50 | 否 | 
| 请求行和标头值的总组合大小 | 10240 字节 | 否 | 
| 负载大小 | 10 MB | 否 | 
| 每个区域每个账户的自定义域数量 | 120 | [可以](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-A93447B8)。 | 
| 访问日志模板大小  | 3 KB | 否 | 
| Amazon CloudWatch Logs 日志条目  | 1MB | 否 | 
| 每个 API 的授权方  | 10 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| 每个授权方的受众  | 50 | 否 | 
| 每个路由的范围  | 10 | 否 | 
| JSON Web 密钥集端点的超时  | 1500 毫秒 | 否 | 
| JSON Web 密钥集端点的响应大小 | 150000 字节 | 否 | 
| OpenID Connect 发现端点的超时  | 1500 毫秒 | 否 | 
| Lambda 授权方响应超时 | 10000 毫秒 | 否 | 
| 每区域每账户的 VPC 链接数 | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-608BDCD4) | 
| 每个 VPC 链接的子网数量  | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-668C9B28) | 
| 每个阶段的阶段变量 | 100 | 否 | 
| 阶段变量中以字符数表示的键长度 | 64 | 否 | 
| 阶段变量中以字符数表示的值长度 | 512 | 否 | 

## 减少配额的最佳实践
<a name="http-api-quotas-best-practices"></a>

以下最佳实践可能有助于减少您当前的资源数量，从而避免增加配额。请确保这些建议适用于您的 API 架构。

**每区域的 API 数**  
要减少每区域的 API 数量，请导出所有未使用的 API，然后将其从 API Gateway 中删除。有关更多信息，请参阅 [从 API Gateway 导出 HTTP API](http-api-export.md)。

**每个 API 的阶段**  
要减少每个 API 的阶段数，请将您的 API 拆分为多个 API。

**每个 API 的授权方**  
要减少每个 API 的授权方数量，请跨 API 方法重用授权方。

# 在 API Gateway 中配置门户的配额
<a name="api-gateway-portal-quotas"></a>

以下配额适用于在 API Gateway 中创建门户。有关更多信息，请参阅 [API Gateway 门户](apigateway-portals.md)。


| 资源或操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| 每个账户的门户数 | 15 | 是 | 
| 每个门户的门户产品数 | 200 | 是 | 
| 每个账户的门户产品数 | 2000 | 是 | 
| 每个门户产品的产品 REST 端点页面数 | 40 | 是 | 
| 每个门户产品的产品页面数 | 40 | 是 | 
| 徽标大小 | 200 KB | 否 | 
| 每个产品 REST 端点页面的文档页面大小 | 32,000 个字符 | 否 | 
| 产品页面的自定义页面大小 | 32,000 个字符 | 否 | 
| 每个门户的自定义域名数 | 1 | 否 | 
| 每个门户的授权方数 | 1 | 否 | 

# API Gateway 中用于配置和运行 WebSocket API 的配额
<a name="apigateway-execution-service-websocket-limits-table"></a>

在 Amazon API Gateway 中配置和运行 WebSocket API 时适用以下配额。如果配额是按 API 分配的，则只能对特定的 API 增加配额，而不能对账户中的所有 API 增加配额。有关账户级别配额的信息，请参阅[Amazon API Gateway 配额](limits.md)


| 资源或操作 | 默认配额 | 能否增加 | 
| --- | --- | --- | 
| 每区域每账户（跨所有 WebSocket API）的每秒新连接数 | 500 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-9ED1E49A) | 
| 并发连接 | 不适用 \$1 | 不适用 | 
| AWS Lambda每个 API 的 授权方 | 10 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| AWS Lambda 授权方结果大小 | 8 KB | 否 | 
| 每 API 的路由数 | 300 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-01C8A9E0) | 
| 每 API 的集成数 | 300 |  是 要提高该配额，请联系 [AWS Support Center](https://console.aws.amazon.com/support/home#/)  | 
| 集成超时 | 50 毫秒 - 对于所有集成类型（包括 Lambda、Lambda 代理、HTTP、HTTP 代理和AWS集成）均为 29 秒。 | 否 | 
| 每个 API 的阶段 | 10 | [是](https://console.aws.amazon.com/servicequotas/home/services/apigateway/quotas/L-379E48B0) | 
| WebSocket 帧大小 | 32 KB | 否 | 
| 消息负载大小 | 128 KB \$1\$1 | 否 | 
| 最大映射模板大小 | 300KB | 否 | 
| WebSocket API 的连接持续时间 | 2 小时 | 否 | 
| 空闲连接超时 | 10 分钟 | 否 | 
| 以字符数表示的 WebSocket API 的 URL 长度 | 4096 | 否 | 
| 访问日志模板大小 | 3 KB | 否 | 

\$1 API Gateway 不对并发连接强制执行配额。并发连接的最大数量取决于每秒的新连接速率和两小时的最长连接持续时间。例如，默认配额为每秒 500 个新连接，如果客户端在两小时内以最大速率连接，则 API Gateway 最多可提供 3600000 个并发连接。

\$1\$1 由于 WebSocket 帧大小配额为 32 KB，因此必须将大于 32 KB 的消息拆分为多个帧，每个帧大小为 32 KB 或更小。这适用于 `@connections` 命令。如果接收到更大的消息（或更大的帧大小），则连接会关闭并显示代码 1009。

# Amazon API Gateway 重要说明
<a name="api-gateway-known-issues"></a>

下一节详细说明了可能影响您使用 API Gateway 的注意事项。

**Topics**
+ [Amazon API Gateway 关于 HTTP API 的重要说明](#api-gateway-known-issues-http-apis)
+ [Amazon API Gateway 关于 HTTP 和 WebSocket API 的重要说明](#api-gateway-known-issues-http-and-websocket-apis)
+ [Amazon API Gateway 关于 REST 和 WebSocket API 的重要说明](#api-gateway-known-issues-rest-and-websocket-apis)
+ [Amazon API Gateway 关于 WebSocket API 的重要说明](#api-gateway-known-issues-websocket-apis)
+ [Amazon API Gateway 关于 REST API 的重要说明](#api-gateway-known-issues-rest-apis)

## Amazon API Gateway 关于 HTTP API 的重要说明
<a name="api-gateway-known-issues-http-apis"></a>
+ HTTP API 将传入的 `X-Forwarded-*` 标头转换为标准 `Forwarded` 标头，并将附加出口 IP、主机和协议。
+ 如果没有有效载荷且 Content-Length 为 0，API Gateway 会将 Content-type 标头添加到您的请求中。

## Amazon API Gateway 关于 HTTP 和 WebSocket API 的重要说明
<a name="api-gateway-known-issues-http-and-websocket-apis"></a>
+ 对于 HTTP 和 WebSocket API，签名版本 4A 不受 Amazon API Gateway 正式支持。

## Amazon API Gateway 关于 REST 和 WebSocket API 的重要说明
<a name="api-gateway-known-issues-rest-and-websocket-apis"></a>
+ API Gateway 不支持跨 REST 和 WebSocket API 共享自定义域名。
+ 阶段名称只能包含字母数字字符、连字符和下划线。最大长度为 128 个字符。
+ 系统会保留 `/ping` 和 `/sping` 路径用于服务运行状况检查。将这些路径用于带有自定义域的 API 根级资源将无法产生预期的结果。
+ 目前，API Gateway 将日志事件限制为 1024 个字节。超过 1024 个字节的日志事件 (如请求和响应正文) 将被 API Gateway 截断，然后再提交到 CloudWatch 日志。
+ CloudWatch 指标当前将维度名称和值限制为 255 个有效的 XML 字符。（有关更多信息，请参阅 [CloudWatch 用户指南](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension)。） 维度值是用户定义名称的函数，包括 API 名称、标签（阶段）名称和资源名称。选择这些名称时，请注意不要超出 CloudWatch 指标限制。
+ 映射模板的最大大小为 300 KB。

## Amazon API Gateway 关于 WebSocket API 的重要说明
<a name="api-gateway-known-issues-websocket-apis"></a>
+ API Gateway 支持最大 128 KB 的消息负载，最大帧大小为 32 KB。如果消息超过 32 KB，则必须将其拆分为多个帧，每个 32 KB 或更小。如果接收到更大的消息，则连接会关闭并显示代码 1009。

## Amazon API Gateway 关于 REST API 的重要说明
<a name="api-gateway-known-issues-rest-apis"></a>
+ 任何请求 URL 查询字符串都不支持纯文本竖线字符（`|`）和大括号字符（`{` 或 `}`），必须对这些字符进行 URL 编码。
+ 不支持分号字符 (`;`) 的任何请求中的 URL 查询字符串和结果数据被拆分。
+ REST API 在将 URL 编码的请求参数传递给后端集成之前对其进行解码。对于 UTF-8 请求参数，REST API 会对参数进行解码，然后将其作为 unicode 传递给后端集成。REST API 会先对百分比字符（`%`）进行 URL 编码，然后再传递给后端集成。
+ 使用 API Gateway 控制台测试 API 时，如果向后端提供自签名证书、证书链中缺少中间证书，或后端引发了任何其他无法识别的证书相关异常情况，那么您可能会收到“未知端点错误”响应。
+ 对于具有私有集成的 API [https://docs.aws.amazon.com/apigateway/latest/api/API_Resource.html](https://docs.aws.amazon.com/apigateway/latest/api/API_Resource.html) 或 [https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html](https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html) 实体，您应删除对 [https://docs.aws.amazon.com/apigateway/latest/api/API_VpcLink.html](https://docs.aws.amazon.com/apigateway/latest/api/API_VpcLink.html) 的任意硬编码引用。否则，您会具有不固定的集成，并收到错误，说明 VPC 链接仍在使用，即使 `Resource` 或 `Method` 实体已删除。在私有集成通过阶段变量引用 `VpcLink` 时，此行为不适用。
+ 以下后端可能无法通过与 API Gateway 兼容的方式来支持 SSL 客户端身份验证：
  + [NGINX](https://nginx.org/en/)
  +  [Heroku](https://www.heroku.com/)
+ API Gateway 支持大多数 [OpenAPI 2.0 规范](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md)和 [OpenAPI 3.0 规范](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md)，但下列情况除外：
  + 路径段只能包含字母数字字符、下划线、连字符、句点、逗号、冒号和大括号。路径参数必须为单独的路径段。例如，“resource/\$1path\$1parameter\$1name\$1”为有效；而“resource\$1path\$1parameter\$1name\$1” 为无效。
  + 模型名称只能包含字母数字字符。
  + 对于输入参数，仅支持以下属性：`name`、`in`、`required`、`type`、`description`。其他属性将被忽略。
  + `securitySchemes` 类型（如果使用）必须为 `apiKey`。但是，支持通过 [Lambda 授权方](apigateway-use-lambda-authorizer.md)进行 OAuth 2 和 HTTP 基本身份验证；OpenAPI 配置通过[供应商扩展](api-gateway-swagger-extensions-authorizer.md)实现。
  + `deprecated` 字段不受支持且将在导出的 API 中删除。
  + API Gateway 模型是使用 [JSON 架构草案 4](https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-04) 定义的，而不是 OpenAPI 使用的 JSON 架构。
  + 任何架构对象均不支持 `discriminator` 参数。
  + 不支持 `example` 标记。
  + 不支持 `nullable` 字段。
  + `exclusiveMinimum`API Gateway 不支持 。
  + [简单请求验证](api-gateway-method-request-validation.md)中不包括 `maxItems` 和 `minItems` 标签。要解决此问题，请在导入之后、执行验证之前更新模型。
  + 对于 OpenAPI 3.0，您不能在同一个架构中具有对定义使用 `$ref` 的 `oneOf`、`anyOf` 或 `allOf`。您可以直接输入架构，也可以定义单独的 API Gateway 模型资源。有关更多信息，请参阅 [创建更复杂的模型](models-mappings-models.md#api-gateway-request-validation-model-more-complex)。
  + `oneOf` 不支持 OpenAPI 2.0 或生成 SDK。
  + 不支持 `readOnly` 字段。
  + `$ref` 不能用于引用其他文件。
  + OpenAPI 文档根目录不支持 `"500": {"$ref": "#/responses/UnexpectedError"}` 表单的响应定义。要解决此问题，请使用内联架构替换参考。
  + 不支持 `Int32` 或 `Int64` 类型的数字。下面展示了一个示例：

    ```
    "elementId": {
        "description": "Working Element Id",
        "format": "int32",
        "type": "number"
    }
    ```
  + 架构定义不支持十进制数字格式类型 (`"format": "decimal"`)。
  + 在方法响应中，架构定义必须为对象类型，不能是基元类型。例如，不支持 `"schema": { "type": "string"}`。但是，您可以使用以下对象类型解决此问题：

    ```
    "schema": {
         "$ref": "#/definitions/StringResponse"
                }
    
     "definitions": {
        "StringResponse": {
          "type": "string"
        }
      }
    ```
  + API Gateway 不使用在 OpenAPI 规范中定义的根级别安全性。因此，需要在操作级别上定义安全性以正确应用。
  + 不支持该 `default` 关键字。
+ 当使用 Lambda 集成或 HTTP 集成处理方法时，API Gateway 会施加以下限制：
  + 对于标头名称和查询参数，会以区分大小写的方式进行处理。
  + 下表列出了在发送到集成端点或由集成端点发回时，可能会被删除、重新映射或以其他方式修改的标头：在此表中：
    + `Remapped` 表示标头名称从 `<string>` 更改为 `X-Amzn-Remapped-<string>`。

      `Remapped Overwritten` 表示标头名称从 `<string>` 更改为 `X-Amzn-Remapped-<string>`，并且值被覆盖。    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/apigateway/latest/developerguide/api-gateway-known-issues.html)

    \$1 如果 `Authorization` 标头包含[签名版本 4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html) 签名，或者如果使用 `AWS_IAM` 授权，则会删除此标头。
+ 由 API Gateway 生成的 API 的 Android 开发工具包使用 `java.net.HttpURLConnection` 类。如果将 `WWW-Authenticate` 标头重新映射到 `X-Amzn-Remapped-WWW-Authenticate` 导致了 401 响应，那么该类将在运行 Android 4.4 及更早版本的设备上引起未处理的异常。
+  与 API Gateway 生成的 API 的 Java、Android 和 iOS 开发工具包不同，API Gateway 生成的 API 的 JavaScript 开发工具包不支持针对 500 级错误进行重试。
+  方法的测试调用使用默认内容类型 `application/json` 并忽略任何其他内容类型的规范。
+ 通过传递 `X-HTTP-Method-Override` 标头将请求发送到 API 时，API Gateway 覆盖方法。因此，要将标头传递到后端，该标头需要添加到集成请求中。
+  如果某个请求的 `Accept` 标头包含多个媒体类型，API Gateway 将只接受第一个 `Accept` 媒体类型。如果无法控制 `Accept` 媒体类型的顺序并且二进制内容的媒体类型不是列表中的第一个，您可以添加 API 的 `Accept` 列表中的第一个 `binaryMediaTypes` 媒体类型，API Gateway 将您的内容以二进制形式返回。例如，要在浏览器中使用 `<img>` 元素发送 JPEG 文件，该浏览器可能会在请求中发送 `Accept:image/webp,image/*,*/*;q=0.8`。将 `image/webp` 添加到 `binaryMediaTypes` 列表后，端点将收到二进制形式的 JPEG 文件。
+ 当前不支持自定义 `413 REQUEST_TOO_LARGE` 的默认网关响应。
+ API Gateway 对所有集成响应使用 `Content-Type` 标头。默认情况下，内容类型为 `application/json`。