本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
流量政策文件格式
當您使用其中一個 AWS SDKs、 AWS CLI或 Amazon Route 53 API,以程式設計方式建立流量政策時 AWS Tools for Windows PowerShell,請以 JSON 格式的 Document元素指定流量政策的定義。
如需流量政策的詳細資訊,請參閱《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
-
流量政策格式的版本,支援 AWS Local Zones 的最新版本;
2023-05-09。也支援舊版;
2015-10-01。 - RecordType
Amazon Route 53 將根據此流量政策建立的所有資源紀錄集的 DNS 類型。如果您想要將流量路由到下列 AWS 資源,請選擇適用的值:
CloudFront 分佈:選擇 A:IPv4 格式的 IP 地址或 AAAA:IPv6 格式的 IP 地址。
ELB Application Load Balancer:選擇 A:IPv4 格式的 IP 地址或 AAAA:IPv6 格式的 IP 地址。
ELB Classic Load Balancer:選擇 A:IPv4 格式的 IP 地址或 AAAA:IPv6 格式的 IP 地址。
ELB Network Load Balancer:選擇 A:IPv4 格式的 IP 地址 或 AAAA:IPv6 格式的 IP 地址。
Elastic Beanstalk 環境 – 選擇 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。
- 端點
您想要在此流量政策中使用的端點定義。如需詳細資訊,請參閱端點定義的語法。
- 規則
您想要在此流量政策中使用的規則定義。如需詳細資訊,請參閱規則定義的語法。
端點定義的語法
以下是您在流量政策文件中指定的端點定義的語法:
{ "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
指定適用的值:
- value
若要將流量路由到下列清單中資源以外的資源,請
value為 指定Type。- cloudfront
若要將流量路由到 CloudFront 分佈,請
cloudfront為 指定Type。- application-load-balancer
若要將流量路由到 Application Load Balancer,請
application-load-balancer為 指定Type。- elastic-load-balancer
若要將流量路由到 ELB Classic 負載平衡器,請
elastic-load-balancer為 指定Type。- network-load-balancer
若要將流量路由到 ELB 網路負載平衡器,請
network-load-balancer為 指定Type。- elastic-beanstalk
若要將流量路由到 Elastic Beanstalk 環境,請
elastic-beanstalk為 指定Type。- s3-website
若要將流量路由到設定為網站端點的 Amazon S3 儲存貯體,請
s3-website為 指定Type。
- 區域
若要將流量路由到設定為網站端點的 Amazon S3 儲存貯體,請指定您為 建立儲存貯體的區域
Region。對於任何其他資源,請省略Region。- Value
指定適用的值:
- value
若要將流量路由到下列資源以外的資源,請指定對應至您為 指定的值的值
RecordType。例如,如果您A為 指定RecordType,請為 指定 IPv4 格式的 IP 地址Value。- cloudfront
如果您
cloudfront為 指定Type,請指定 CloudFront 在您建立 CloudFront 分佈時指派給 CloudFront 分佈的網域名稱,例如d111111abcdef8.cloudfront.net。- application-load-balancer
如果您
application-load-balancer為 指定Type,請指定負載平衡器的 DNS 名稱。例如exampleAlb-1283637735.us-east-1.elb.amazonaws.com。- elastic-load-balancer
如果您
elastic-load-balancer為 指定Type,請指定負載平衡器的 DNS 名稱。使用開頭為 的值dualstack,例如dualstack.my-load-balancer-1234567890.us-west-2.elb.amazonaws.com。- network-load-balancer
如果您
network-load-balancer為 指定Type,請指定負載平衡器的 DNS 名稱。例如exampleNlb-74f87b114e21682a.elb.us-east-1.amazonaws.com。- elastic-beanstalk
如果您
elastic-beanstalk為 指定Type,請指定 Elastic Beanstalk 環境的網域名稱。例如example-beanstalk-env-1.eba-ns4qrife.us-east-1.elasticbeanstalk.com。- s3-website
如果您
s3-website為 指定Type,請指定 Amazon S3 儲存貯體的名稱,例如example.com.s3-website-us-east-1.amazonaws.com。重要
當您根據此流量政策建立流量政策執行個體時,您在此處指定的儲存貯體必須符合您在 CreateTrafficPolicyInstance 請求
Name中為 指定的網域名稱 (例如 www.example.com)。如果Value和Name不相符,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 評估端點的運作狀態,並將流量僅路由至運作狀態良好的端點。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 EvaluateTargetHealth。
- HealthCheck
如果您想要將運作狀態檢查與端點或規則建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 HealthCheckId。
地理位置規則
當您新增地理位置規則時,您可以設定流量政策,根據使用者的地理位置路由流量。如需詳細資訊,請參閱《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。- 位置
針對您要將流量路由到的每個地理位置
Subdivision,指定一組值Country(EndpointReference|RuleReferenceIsDefault、Continent、EvaluateTargetHealth、、 和HealthCheck)。- EndpointReference | RuleReference
無論您想要將流量路由到端點或另一個規則,以及您在流量政策文件中其他位置指派給端點或規則的 ID。
- IsDefault
布林值,指出這組值是否代表預設位置。如果您將 指定
*為地理位置中CountryCode元素的值,則此位置的IsDefault元素值True預設為 ,而且您無法將 指定True為相同地理位置規則在其他地理位置中IsDefault元素的值。如需將 指定*為CountryCode元素值的詳細資訊,請參閱 的下列項目Continent, Country, Subdivision。- Continent、Country、Subdivision
指出您要將流量路由到規則或端點之使用者的地理位置的值。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的下列元素說明:
GeoLocationContinentCodeCountryCodeSubdivisionCode
如需詳細資訊,請參閱《Amazon Route 53 開發人員指南》中的位置。
重要
地理位置的運作方式是將 IP 地址對應到位置。不過,有些 IP 地址不會映射至地理位置,因此即使您建立涵蓋所有七大洲的地理位置,Route 53 也會從無法識別的位置收到一些 DNS 查詢。建議您建立 值
Country為 的地理位置*。兩組查詢會路由至您在此記錄中指定的資源:來自您尚未建立地理位置的位置的查詢,以及來自未對應至位置之 IP 地址的查詢。如果您未建立*地理位置,Route 53 會針對來自未映射位置的查詢傳回「無回應」回應。- EvaluateTargetHealth
布林值,指出您是否希望 Amazon Route 53 評估端點的運作狀態,並將流量僅路由至運作狀態良好的端點。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 EvaluateTargetHealth。
- HealthCheck
如果您想要將運作狀態檢查與端點或規則建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 HealthCheckId。
地理位置鄰近性規則
當您新增地理位置鄰近性規則時,您可以設定 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 區域、本地區域和經度
AWSPolicyFormatVersion 2023-05-09。您也可以在 中指定 AWS 區域或地理位置的經緯度AWSPolicyFormatVersion 2015-10-01。- EndpointReference | RuleReference
無論您想要將流量路由到端點或另一個規則,以及您在流量政策文件中其他位置指派給端點或規則的 ID。
- 位置 (
AWSPolicyFormatVersion 2023-05-09僅限 ) 位置欄位支援 AWS 區域、本地區域和經度,格式如下:
對於本機區域:
"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 Zone,請參閱 AWS Local Zones locations
。 - 區域 (
AWSPolicyFormatVersion 2015-10-01僅限 ) 如果您的端點是 AWS 資源,請指定您在其中建立資源 AWS 的區域。使用下列格式:
aws:route53:region-code如需有效區域代碼的清單,請參閱 ChangeResourceRecordSets 文件中的區域。
- 經緯度 (
AWSPolicyFormatVersion 2015-10-01僅限 ) 如果您的端點不是 AWS 資源,請輸入資源位置的經緯度。注意下列事項:
緯度代表赤道以南 (負) 或以北 (正) 的位置。有效值為 -90 度到 90 度。
經度代表本初子午線以西 (負) 或以東 (正) 的位置。有效值為 -180 度到 180 度。
您可以從一些線上地圖應用程式取得經緯度。例如,在 Google Maps,位置的 URL 指定經緯度:
https://www.google.com/maps/@47.6086111,-122.3409953,20z
您可以輸入最多兩個十進位的精確度,例如
47.61。如果您指定精確度更高的值,Route 53 會傳回錯誤。對於赤道處的緯度和經度,0.01 度大約是 0.69 英里。
- 偏差
Bias如果您想要將更多流量從附近的端點 (正值) 路由到端點,或將較少流量路由到端點 (負值),請指定 的值。有效值的範圍是 -99 到 99;預設值為 0。重要
的值
Bias是相對的,根據其他資源的位置,而不是絕對,根據距離。因此,變更的效果難以預測。例如,根據您的資源所在位置,將偏差從10變更為15可能意味著從紐約市都會區域新增或減去大量流量之間的差異。我們建議您以較小的增量變更偏差並對結果進行評估,然後進行其他變更 (如果適用)。- EvaluateTargetHealth
布林值,指出您是否希望 Route 53 評估端點的運作狀態,並將流量僅路由至運作狀態良好的端點。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 EvaluateTargetHealth。
- HealthCheck
如果您想要將運作狀態檢查與端點或規則建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 HealthCheckId。
延遲規則
當您新增延遲規則時,您可以設定流量政策,根據使用者與您建立 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|RuleReferenceEvaluateTargetHealth、、Region和HealthCheck)。- EndpointReference | RuleReference
無論您想要將流量路由到端點或另一個規則,以及您在流量政策文件中其他位置指派給端點或規則的 ID。
- 區域
您建立資源所在 AWS 區域的區域代碼。如需有效區域代碼的清單,請參閱 ChangeResourceRecordSets 文件中的區域。
- EvaluateTargetHealth
布林值,指出您是否希望 Amazon Route 53 評估端點的運作狀態,並將流量僅路由至運作狀態良好的端點。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 EvaluateTargetHealth。
- HealthCheck
如果您想要將運作狀態檢查與端點或規則建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 HealthCheckId。
多值回答規則
當您新增多值回答規則時,您可以設定流量政策,將流量大約隨機路由到運作狀態良好的資源。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。- 項目
針對您要路由流量的每個多值回答規則或端點,指定一組值 (
EndpointReference和HealthCheck)。- EndpointReference
您在流量政策文件中其他位置指派給端點的 ID。
- HealthCheck
如果您想要將運作狀態檢查與端點建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 HealthCheckId。
加權規則
當您新增加權規則時,您可以設定流量政策,根據您指定的比例路由流量。例如,您可以指定 4、5、5 和 6 的權重 (總和 = 20)。結果是平均 4/20 的流量路由到第一個端點或規則,5/20 同時路由到第二個和第三個端點或規則,而 6/20 路由到最後一個端點或規則。如需詳細資訊,請參閱《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|RuleReferenceEvaluateTargetHealth、、Weight和HealthCheck)。- EndpointReference | RuleReference
無論您想要將流量路由到端點或另一個規則,以及您在流量政策文件中其他位置指派給端點或規則的 ID。
- Weight (粗細)
介於 0 到 255 之間的值,決定路由至對應端點或規則的流量比例。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的權重。
- EvaluateTargetHealth
布林值,指出您是否希望 Amazon Route 53 評估端點的運作狀態,並將流量僅路由至運作狀態良好的端點。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 EvaluateTargetHealth。
- HealthCheck
如果您想要將運作狀態檢查與端點或規則建立關聯,請指定運作狀態檢查的 ID。如需詳細資訊,請參閱 ChangeResourceRecordSets 文件中的 HealthCheckId。
範例
下列範例示範如何使用容錯移轉、地理位置、地理位置鄰近性、延遲和加權規則,以及如何在相同的流量政策中使用多種類型的規則。
容錯移轉範例
{ "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" } } } }