View a markdown version of this page

交通政策文件格式 - Amazon Route 53

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

交通政策文件格式

当您使用 Amazon Route 53 API、其中一个软件开发 AWS 工具包、或以编程方式创建流量策略时 AWS Tools for Windows PowerShell,您可以在 JSON 格式的Document元素中指定流量策略的定义。 AWS CLI

有关流量策略的更多信息,请参阅 Amazon Route 53 开发者指南中的使用流量路由 DNS 流量。

基本语法

以下是流量策略文档的基本语法:

{ "AWSPolicyFormatVersion": "2015-10-01 | 2023-05-09", "RecordType": "DNS type for all resource record sets created by this traffic policy", "StartEndpoint | StartRule": "ID that you assign to an endpoint or rule", "Endpoints": { "Endpoint ID that you assign": { Endpoint definition }, ... }, "Rules": { "Rule ID that you assign": { Rule definition }, ... } }

流量策略文档的基本语法包含以下对象:

AWSPolicyFormatVersion

流量策略格式的版本,支持 L AWS ocal Zones 的最新版本;2023-05-09

还支持以前的版本;2015-10-01.

RecordType

Amazon Route 53 将根据此流量策略创建的所有资源记录集的 DNS 类型。如果要将流量路由到以下 AWS 资源,请选择适用的值:

  • CloudFront 分发 — 选择 A: IPv4 格式的 IP 地址AAAA: IPv6 格式的 IP 地址

  • ELB 应用程序负载均衡器 - 选择 A:IPv4 格式的 IP 地址AAAA:IPv6 格式的 IP 地址

  • ELB 经典负载均衡器 - 选择 A:IPv4 格式的 IP 地址AAAA:IPv6 格式的 IP 地址

  • ELB 网络负载均衡器 - 选择 A:IPv4 格式的 IP 地址AAAA:IPv6 格式的 IP 地址

  • Elastic Beanst alk 环境 — 选择 A:IPv4 格式的 IP 地址或 AAAA:IPv6 格式的 IP 地址。

  • 配置为网站终端节点的 Amazon S3 存储桶:选择 A: IP address in IPv4 format(A:IPv4 格式的 IP 地址)

如果要将流量路由到其他资源,请为该资源选择适用的类型。例如,如果要将流量路由到邮件服务器,请指定MX。有关 Route 53 支持的 DNS 类型列表,请参阅 Amazon Route 53 开发者指南中的支持的 DNS 资源记录类型

StartEndpoint | StartRule

无论您希望流量策略的起点是端点还是规则,以及您在流量策略文档其他地方为端点或规则分配的 ID。

端点

您要在此流量策略中使用的终端节点的定义。有关更多信息,请参阅 端点定义的语法

Rules

您要在此流量策略中使用的规则的定义。有关更多信息,请参阅 规则定义的语法

端点定义的语法

以下是您在流量策略文档中指定的端点定义的语法:

{ "Type": value | cloudfront | application-load-balancer | elastic-load-balancer | network-load-balancer | elastic-beanstalk | s3-website, "Region": "AWS region that you created your Amazon S3 bucket in" "Value": "value applicable to the type of endpoint" }

端点定义的语法包含以下对象:

Type

指定适用的值:

要将流量路由到以下列表以外的资源,请指定valueType

cloudfront

要将流量路由到分 CloudFront 配,请指定cloudfrontType

应用程序负载均衡器

要将流量路由到 Application Load Balancer,请指定application-load-balancerType

弹性负载均衡器

要将流量路由到 ELB Classic 负载均衡器,请指定elastic-load-balancerType

网络负载均衡器

要将流量路由到 ELB 网络负载均衡器,请指定network-load-balancerType

弹性豆茎

要将流量路由到 Elastic Beanstalk 环境,请指定。elastic-beanstalk Type

s3 网站

要将流量路由到配置为网站终端节点的 Amazon S3 存储桶,请指定s3-websiteType

Region

要将流量路由到配置为网站终端节点的 Amazon S3 存储桶,请指定您为其创建存储桶的区域Region。对于任何其他资源,请省略Region

指定适用的值:

要将流量路由到下列资源以外的资源,请指定与您为其指定的值相对应的值RecordType。例如,如果您为指定RecordType,则A为指定一个 IPv4 格式的 Value IP 地址。

cloudfront

如果您cloudfront为指定了Type,请指定在创建 CloudFront 分配时 CloudFront 分配给您的分配的域名,例如d111111abcdef8.cloudfront.net

应用程序负载均衡器

如果您application-load-balancer为指定了Type,请为您的负载均衡器指定 DNS 名称。例如 exampleAlb-1283637735.us-east-1.elb.amazonaws.com

弹性负载均衡器

如果您elastic-load-balancer为指定了Type,请为您的负载均衡器指定 DNS 名称。例如,使用以dualstack开头的值dualstack.my-load-balancer-1234567890.us-west-2.elb.amazonaws.com

网络负载均衡器

如果您network-load-balancer为指定了Type,请为您的负载均衡器指定 DNS 名称。例如 exampleNlb-74f87b114e21682a.elb.us-east-1.amazonaws.com

弹性豆茎

如果您elastic-beanstalk为指定了域名Type,请为您的 Elastic Beanstalk 环境指定域名。例如 example-beanstalk-env-1.eba-ns4qrife.us-east-1.elasticbeanstalk.com

s3 网站

如果您s3-website为指定了Type,请指定您的 Amazon S3 存储桶的名称,例如example.com.s3-website-us-east-1.amazonaws.com

重要

当您基于此流量策略创建流量策略实例时,您在此处指定的存储桶必须与您在请求中指定的域名(例如 www.example.com)匹配。Name CreateTrafficPolicyInstance如果ValueName不匹配,则 Amazon S3 将不会响应针对该域名的 DNS 查询。

规则定义的语法

根据要使用的路由策略类型,您在流量策略文档中指定的规则定义有不同的语法:故障转移、地理位置、地理位置、延迟、多值答案或加权。

故障转移规则

有关更多信息,请参阅 Amazon Route 53 开发人员指南中的配置 DNS 故障转移

{ "RuleType": "failover", "Primary": { "EndpointReference | RuleReference": "ID that you assigned to the rule or endpoint that this rule routes traffic to", "EvaluateTargetHealth": "true" | "false", "HealthCheck": "optional health check ID" }, "Secondary": { "EndpointReference | RuleReference": "ID that you assigned to the rule or endpoint that this rule routes traffic to", "EvaluateTargetHealth": "true" | "false", "HealthCheck": "optional health check ID" } }

定义故障转移规则时,需要指定以下对象:

RuleType

指定 failover

小学 | 中学

对于Primary对象,为要在相应资源可用时将流量路由到的规则或端点指定设置。

对于Secondary对象,为要在主资源不可用时将流量路由到的规则或端点指定设置。

EndpointReference | RuleReference

您是要将流量路由到终端节点还是其他规则,以及您在流量策略文档其他地方为该端点或规则分配的 ID。

EvaluateTargetHealth

一个布尔值,表示您是否希望 Amazon Route 53 评估终端节点的运行状况并仅将流量路由到运行状况良好的终端节点。有关更多信息,请参阅相关文档EvaluateTargetHealth中的ChangeResourceRecordSets

HealthCheck

如果要将运行状况检查与终端节点或规则相关联,请指定运行状况检查的 ID。有关更多信息,请参阅相关文档HealthCheckId中的ChangeResourceRecordSets

地理定位规则

添加地理定位规则时,您可以将流量策略配置为根据用户的地理位置对流量进行路由。有关更多信息,请参阅 Amazon Route 53 开发者指南中的地理位置路

{ "RuleType": "geo", "Locations": [ { "EndpointReference | RuleReference": "ID that you assigned to the rule or endpoint that this rule routes traffic to", "IsDefault": "true" | "false", "Continent": "continent name, "Country": "country name, "Subdivision": "subdivision name, "EvaluateTargetHealth": "true" | "false", "HealthCheck": "optional health check ID" }, ... ] }

定义地理定位规则时,需要指定以下对象:

RuleType

指定 geo

位置

为要将流量路由到的每个地理位置指定一组值(EndpointReference| RuleReference IsDefault Continent Country Subdivision EvaluateTargetHealth、、、、、、和HealthCheck)。

EndpointReference | RuleReference

您是要将流量路由到终端节点还是其他规则,以及您在流量策略文档其他地方为该端点或规则分配的 ID。

IsDefault

一个布尔值,用于指示这组值是否表示默认位置。如果您指定*为某个地理位置中CountryCode元素的值,则True默认情况下,该位置的IsDefault元素值将设置为,并且您不能根据相同的地理位置规则将该IsDefault元素的值指定True为其他地理位置的元素值。有关指定*CountryCode元素值的更多信息,请参阅以下条目Continent, Country, Subdivision

大陆、国家、分区

表示您要将其流量路由到规则或端点的用户的地理位置的值。有关更多信息,请参阅相关文档中的以下元素描述 ChangeResourceRecordSets

  • GeoLocation

  • ContinentCode

  • CountryCode

  • SubdivisionCode

有关更多信息,请参阅 Amazon Route 53 开发者指南中的位置

重要

地理位置路由的工作原理是将 IP 地址映射到位置。但是,有些 IP 地址未映射到地理位置,因此,即使您创建了覆盖所有七大洲的地理位置,Route 53 也会收到一些来自它无法识别的位置的 DNS 查询。我们建议您创建一个值为的地理位置*Country两组查询会路由到您在此记录中指定的资源:来自您尚未为其创建地理位置的位置的查询,以及来自未映射到某个位置的 IP 地址的查询。如果您不创建*地理位置,Route 53 会针对来自未映射位置的查询返回 “无答案” 响应。

EvaluateTargetHealth

一个布尔值,表示您是否希望 Amazon Route 53 评估终端节点的运行状况并仅将流量路由到运行状况良好的终端节点。有关更多信息,请参阅相关文档EvaluateTargetHealth中的ChangeResourceRecordSets

HealthCheck

如果要将运行状况检查与终端节点或规则相关联,请指定运行状况检查的 ID。有关更多信息,请参阅相关文档HealthCheckId中的ChangeResourceRecordSets

地理位置邻近规则

添加地理邻近性规则时,您可以将 Amazon Route 53 配置为根据资源的地理位置将流量路由到您的资源。您也可以选择通过指定偏差将更多或更少的流量路由到给定的端点或规则。您可以使用偏差来扩大或缩小流量从中路由到终端节点或规则的地理区域的大小。有关更多信息,请参阅 Amazon Route 53 开发者指南中的邻近地理路

以下示例AWSPolicyFormatVersion 2023-05-09仅适用于:

{ "RuleType": "geoproximity", "GeoproximityLocations": [ { "EndpointReference | RuleReference": "ID that you assigned to the endpoint or rule that this rule routes traffic to", "Location":{ "Type": "Region | LocalZone", "LocationName": "AWS Region | AWS Local Zone" }, "Bias": "optional value to expand or shrink the geographic region for this rule, -99 to 99", "EvaluateTargetHealth": "true | false", "HealthCheck": "optional health check ID" }, { "EndpointReference | RuleReference": "ID that you assigned to the endpoint or rule that this rule routes traffic to", "Location":{ "Type": "Coordinate", "Latitude": "location south (negative) or north (positive) of the equator, -90 to 90 degrees", "Longitude": "location west (negative) or east (positive) of the prime meridian, -180 to 180 degrees" }, "Bias": "optional value to expand or shrink the geographic region for this rule, -99 to 99", "EvaluateTargetHealth": "true | false", "HealthCheck": "optional health check ID" } ] }

以下示例AWSPolicyFormatVersion 2015-10-01仅适用于:

{ "RuleType": "geoproximity", "GeoproximityLocations": [ { "EndpointReference | RuleReference": "ID that you assigned to the endpoint or rule that this rule routes traffic to", "Region": "AWS Region", "Bias": "optional value to expand or shrink the geographic region for this rule, -99 to 99", "EvaluateTargetHealth": "true | false", "HealthCheck": "optional health check ID" }, { "EndpointReference | RuleReference": "ID that you assigned to the endpoint or rule that this rule routes traffic to", "Latitude": "location south (negative) or north (positive) of the equator, -90 to 90 degrees", "Longitude": "location west (negative) or east (positive) of the prime meridian, -180 to 180 degrees", "Bias": "optional value to expand or shrink the geographic region for this rule, -99 to 99", "EvaluateTargetHealth": "true | false", "HealthCheck": "optional health check ID" } ] }

在定义地理邻近度规则时,需要指定以下对象:

RuleType

指定 geoproximity

GeoproximityLocations

为要将流量路由到的每个资源指定一组值。您可以指定位置字段,该字段支持 AWS Regions、Local Zones 以及中的纬度和经度。AWSPolicyFormatVersion 2023-05-09您还可以在中指定 AWS 区域或地理位置的纬度和经度。AWSPolicyFormatVersion 2015-10-01

EndpointReference | RuleReference

您是要将流量路由到终端节点还是其他规则,以及您在流量策略文档其他地方为该端点或规则分配的 ID。

地点(AWSPolicyFormatVersion 2023-05-09仅限)

Location 字段支持 AWS 区域、Local Zones 以及纬度和经度,格式如下:

对于 Local Zones:"Location": { "Type": "LocalZone", "LocationName": "aws:route53:us-east-1-atl-1a" }

对于区域:"Location": { "Type": "Region", "LocationName": "aws:route53:us-east-1" },

对于坐标:"Location": { "Type": "Coordinate", "Latitude": "38.9", "Longitude": "-77.01" },

有关有效区域代码的列表,请参阅相关文档中的区域ChangeResourceRecordSets

有关可用的 Local Zones,请参阅 AWS Local Zones 位置

区域(AWSPolicyFormatVersion 2015-10-01仅限)

如果您的终端节点是 AWS 资源,请指定您在其中创建资源的 AWS 区域。采用以下格式:

aws:route53:region-code

有关有效区域代码的列表,请参阅相关文档中的区域ChangeResourceRecordSets

纬度和经度(AWSPolicyFormatVersion 2015-10-01仅限)

如果您的终端节点不是 AWS 资源,请输入资源所在位置的纬度和经度。注意以下几点:

  • 纬度代表赤道以南 (负) 或以北 (正) 的位置。有效值为 -90 度到 90 度。

  • 经度代表主子午线以西 (负) 或以东 (正) 的位置。有效值为 -180 度到 180 度。

  • 您可以从一些联机映射应用程序中获得纬度和经度。例如,在 Google 地图中,位置的 URL 指定了纬度和经度:

    https://www.google.com/maps/@ 47.6086 111,-122.3409953,20z

  • 例如,您最多可以输入两位小数点的精度。47.61如果您指定的值精度更高,则 Route 53 会返回错误。对于赤道处的纬度和经度,0.01 度大约是 0.69 英里。

偏差

Bias如果要将更多流量从附近的终端节点路由到终端节点(正值)或将较少的流量路由到终端节点(负值),请为指定一个值。有效值范围为 -99 到 99;默认值为 0。

重要

的值Bias是基于其他资源位置的相对值,而不是基于距离的绝对值。因此,更改的影响是难以预测的。例如,根据您的资源所在的位置,将偏差从更改1015可能意味着增加或减少来自纽约市都会区的大量流量。我们建议您以较小的增量更改偏差并对结果进行评估,然后进行其他更改 (如果适用)。

EvaluateTargetHealth

一个布尔值,表示您是否希望 Route 53 评估终端节点的运行状况并仅将流量路由到健康的终端节点。有关更多信息,请参阅相关文档EvaluateTargetHealth中的ChangeResourceRecordSets

HealthCheck

如果要将运行状况检查与终端节点或规则相关联,请指定运行状况检查的 ID。有关更多信息,请参阅相关文档HealthCheckId中的ChangeResourceRecordSets

延迟规则

添加延迟规则时,您可以配置流量策略,根据用户与创建 AWS 资源(例如 ELB 负载均衡器和 Amazon S3 存储桶)的 AWS 区域之间的延迟(时间延迟)来路由流量。有关更多信息,请参阅 Amazon Route 53 开发人员指南中的延迟路

{ "RuleType": "latency", "Regions": [ { "EndpointReference | RuleReference": "ID that you assigned to the rule or endpoint that this rule routes traffic to", "Region": "AWS region that you want to route traffic to", "EvaluateTargetHealth": "true" | "false", "HealthCheck": "optional health check ID" }, ... ] }

在定义延迟规则时,需要指定以下对象:

RuleType

指定 latency

Regions

为要将流量路由到的每个区域指定一组值(EndpointReference| RuleReference EvaluateTargetHealth、、和HealthCheck)。Region

EndpointReference | RuleReference

您是要将流量路由到终端节点还是其他规则,以及您在流量策略文档其他地方为该端点或规则分配的 ID。

Region

您在其中创建资源的 AWS 区域的区域代码。有关有效区域代码的列表,请参阅相关文档中的区域ChangeResourceRecordSets

EvaluateTargetHealth

一个布尔值,表示您是否希望 Amazon Route 53 评估终端节点的运行状况并仅将流量路由到运行状况良好的终端节点。有关更多信息,请参阅相关文档EvaluateTargetHealth中的ChangeResourceRecordSets

HealthCheck

如果要将运行状况检查与终端节点或规则相关联,请指定运行状况检查的 ID。有关更多信息,请参阅相关文档HealthCheckId中的ChangeResourceRecordSets

多值答案规则

添加多值答案规则时,您可以将流量策略配置为将流量大致随机路由到您的健康资源。Amazon Route 53 最多使用八条健康记录响应 DNS 查询;如果您的健康记录不超过八个,则 Route 53 会使用所有健康记录来响应所有 DNS 查询。有关更多信息,请参阅 MultiValueAnswer

{ "RuleType": "multivalue", "Items": [ { "EndpointReference": "ID that you assigned to the endpoint that this rule routes traffic to", "HealthCheck": "optional health check ID" }, ... ] }

定义多值答案规则时,需要指定以下对象:

RuleType

指定 multivalue

物品

为要将流量路由到的每条多值答案规则或端点指定一组值(EndpointReferenceHealthCheck)。

EndpointReference

您在流量策略文档的其他地方分配给端点的 ID。

HealthCheck

如果要将运行状况检查与终端节点关联,请指定运行状况检查的 ID。有关更多信息,请参阅 HealthCheckId

加权规则

添加加权规则时,您可以将流量策略配置为根据您指定的比例路由流量。例如,您可以将权重指定为 4、5、5 和 6(总和 = 20)。结果是, 4/20ths 平均而言,您的流量会路由到第一个端点或规则, 5/20ths 同时路由到第二个和第三个终端节点或规则,然后 6/20ths 路由到最后一个端点或规则。有关更多信息,请参阅 Amazon Route 53 开发人员指南中的加权路由

{ "RuleType": "weighted", "Items": [ { "EndpointReference | RuleReference": "ID that you assigned to the rule or endpoint that this rule routes traffic to", "Weight": "value between 0 and 255", "EvaluateTargetHealth": "true" | "false", "HealthCheck": "optional health check ID" }, ... ] }

定义加权规则时,需要指定以下对象:

RuleType

指定 weighted

物品

为要将流量路由到的每个加权规则或端点指定一组值(EndpointReference| RuleReference EvaluateTargetHealth、、和HealthCheck)。Weight

EndpointReference | RuleReference

您是要将流量路由到终端节点还是其他规则,以及您在流量策略文档其他地方为该端点或规则分配的 ID。

重量

介于 0 和 255 之间的值,用于确定路由到相应端点或规则的流量比例。有关更多信息,请参阅相关文档中的重量ChangeResourceRecordSets

EvaluateTargetHealth

一个布尔值,表示您是否希望 Amazon Route 53 评估终端节点的运行状况并仅将流量路由到运行状况良好的终端节点。有关更多信息,请参阅相关文档EvaluateTargetHealth中的ChangeResourceRecordSets

HealthCheck

如果要将运行状况检查与终端节点或规则相关联,请指定运行状况检查的 ID。有关更多信息,请参阅相关文档HealthCheckId中的ChangeResourceRecordSets

示例

以下示例说明如何使用故障转移、地理位置、地理位置、延迟和加权规则,以及如何在同一个流量策略中使用多种类型的规则。

故障转移示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"site_switch", "Endpoints":{ "my_elb":{ "Type":"elastic-load-balancer", "Value":"elb-111111.us-east-1.elb.amazonaws.com" }, "site_down_banner":{ "Type":"s3-website", "Region":"us-east-1", "Value":"www.example.com" } }, "Rules":{ "site_switch":{ "RuleType":"failover", "Primary":{ "EndpointReference":"my_elb" }, "Secondary":{ "EndpointReference":"site_down_banner" } } } }

地理定位示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"geo_dest", "Endpoints":{ "english":{ "Type":"value", "Value":"192.0.2.1" }, "french":{ "Type":"value", "Value":"192.0.2.2" }, "german":{ "Type":"value", "Value":"192.0.2.3" } }, "Rules":{ "geo_dest":{ "RuleType":"geo", "Locations":[ { "EndpointReference":"english", "Country":"*", "HealthCheck":"11111111-1111-1111-1111-111111111111" }, { "EndpointReference":"french", "Country":"FR", "IsDefault":false, "HealthCheck":"22222222-2222-2222-2222-222222222222" }, { "EndpointReference":"french", "Country":"BE", "IsDefault":false, "HealthCheck":"22222222-2222-2222-2222-222222222222" }, { "EndpointReference":"german", "Country":"DE", "IsDefault":false, "HealthCheck":"33333333-3333-3333-3333-333333333333" } ] } } }

地理邻近示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"geoprox-rule", "Endpoints":{ "aws-us-west-1-region":{ "Type":"elastic-load-balancer", "Value":"elb-123456.us-east-1.elb.amazonaws.com" }, "london-data-center":{ "Type":"value", "Value":"192.0.2.1" } }, "Rules":{ "geoprox-rule":{ "RuleType": "geoproximity", "GeoproximityLocations": [ { "EndpointReference": "aws-us-west-1-region", "Region": "aws:route53:us-west-1", "Bias": "10", "HealthCheck": "11111111-1111-1111-1111-111111111111" }, { "EndpointReference": "london-data-center", "Latitude": "51.50", "Longitude": "-0.16", "Bias": "0", "HealthCheck": "22222222-2222-2222-2222-222222222222" } ] } } }
{ "AWSPolicyFormatVersion":"2023-05-09", "RecordType":"A", "StartRule":"geoprox-rule", "Endpoints":{ "aws-us-west-1-region":{ "Type":"elastic-load-balancer", "Value":"elb-123456.us-west-1.elb.amazonaws.com" }, "aws-us-east-1-atl-local-zone":{ "Type":"elastic-load-balancer", "Value":"elb-123456.us-east-1.elb.amazonaws.com" }, "london-data-center":{ "Type":"value", "Value":"192.0.2.1" } }, "Rules":{ "geoprox-rule":{ "RuleType": "geoproximity", "GeoproximityLocations": [ { "EndpointReference": "aws-us-west-1-region", "Location": { "Type": "Region", "LocationName": "aws:route53:us-west-1" }, "Bias": "-10", "HealthCheck": "11111111-1111-1111-1111-111111111111" }, { "EndpointReference": "aws-us-east-1-atl-local-zone", "Location": { "Type": "LocalZone", "LocationName": "aws:route53:us-east-1-atl-1a" }, "Bias": "10", "HealthCheck": "22222222-2222-2222-2222-222222222222" }, { "EndpointReference": "london-data-center", "Location": { "Type": "Coordinate", "Latitude": "51.50", "Longitude": "-0.16" }, "Bias": "0", "HealthCheck": "33333333-3333-3333-3333-333333333333" } ] } } }

延迟示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"region_selector", "Endpoints":{ "us_lb":{ "Type":"elastic-load-balancer", "Value":"elb-123456.us-east-1.elb.amazonaws.com" }, "europe_lb":{ "Type":"elastic-load-balancer", "Value":"elb-654321.eu-west-1.elb.amazonaws.com" } }, "Rules":{ "region_selector":{ "RuleType":"latency", "Regions":[ { "Region":"us-east-1", "EndpointReference":"us_lb" }, { "Region":"eu-west-1", "EndpointReference":"europe_lb" } ] } } }

加权示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"round_robin", "Endpoints":{ "srv1":{ "Type":"value", "Value":"192.0.2.1" }, "srv2":{ "Type":"value", "Value":"192.0.2.2" }, "srv3":{ "Type":"value", "Value":"192.0.2.3" } }, "Rules":{ "round_robin":{ "RuleType":"weighted", "Items":[ { "EndpointReference":"srv1", "Weight":"3", "HealthCheck":"11111111-1111-1111-1111-111111111111" }, { "EndpointReference":"srv2", "Weight":"1", "HealthCheck":"22222222-2222-2222-2222-222222222222" }, { "EndpointReference":"srv3", "Weight":"1", "HealthCheck":"33333333-3333-3333-3333-333333333333" } ] } } }

故障转移、延迟和地理定位规则示例

{ "AWSPolicyFormatVersion":"2015-10-01", "RecordType":"A", "StartRule":"geo_restriction", "Endpoints":{ "east_coast_lb1":{ "Type":"elastic-load-balancer", "Value":"elb-111111.us-east-1.elb.amazonaws.com" }, "east_coast_lb2":{ "Type":"elastic-load-balancer", "Value":"elb-222222.us-east-1.elb.amazonaws.com" }, "west_coast_lb1":{ "Type":"elastic-load-balancer", "Value":"elb-111111.us-west-1.elb.amazonaws.com" }, "west_coast_lb2":{ "Type":"elastic-load-balancer", "Value":"elb-222222.us-west-1.elb.amazonaws.com" }, "denied_message":{ "Type":"s3-website", "Region":"us-east-1", "Value":"video.example.com" } }, "Rules":{ "geo_restriction":{ "RuleType":"geo", "Locations":[ { "EndpointReference":"denied_message", "IsDefault":true }, { "RuleReference":"region_selector", "Country":"US" } ] }, "region_selector":{ "RuleType":"latency", "Regions":[ { "Region":"us-east-1", "RuleReference":"east_coast_region" }, { "Region":"us-west-1", "RuleReference":"west_coast_region" } ] }, "east_coast_region":{ "RuleType":"failover", "Primary":{ "EndpointReference":"east_coast_lb1" }, "Secondary":{ "EndpointReference":"east_coast_lb2" } }, "west_coast_region":{ "RuleType":"failover", "Primary":{ "EndpointReference":"west_coast_lb1" }, "Secondary":{ "EndpointReference":"west_coast_lb2" } } } }