How do I create Route 53 traffic policy records using the AWS CLI?
I want to create traffic policy records in Amazon Route 53 to route DNS traffic flow to multiple resources.
"I want to create traffic policy records in Amazon Route 53 to route DNS traffic flow to multiple resources.Short descriptionYou can use the AWS Command Line Interface (AWS CLI) to create Route 53 traffic policy records. Before you begin, install and configure the AWS CLI.If you want to use the Route 53 console to create a traffic policy, then see Creating a traffic policy.ResolutionCreate a traffic policy with the AWS CLICreate a JSON file that defines your traffic policy configuration. For basic syntax, endpoints, and rules, refer to Traffic policy document format.To create your traffic policy in the AWS CLI, run the create-traffic-policy command with your own parameters:$ aws route53 create-traffic-policy --name POLICY_NAME --document file://JSON_FILENote: Replace POLICY_NAME with your policy name. Replace JSON_FILE with the full path of your JSON file.The following parameters are required:--name--documentThe following parameters are optional:--comment--cli-input-json--generate-cli-skeletonIn the output, note the traffic policy ID and version number:{  "TrafficPolicy": {    "Document": JSON_DOCUMENT,    "Version": VERSION_NUMBER,    "Type": "POLICY_TYPE",    "Id": "TRAFFIC_POLICY_ID",    "Name": "POLICY_NAME"  }}To create a traffic policy record, run the create-traffic-policy-instance API call.$ aws route53 create-traffic-policy-instance --hosted-zone-id VALUE --name VALUE --ttl VALUE --traffic-policy-id VALUE --traffic-policy-version VALUENote: Replace each VALUE with your relevant value for that parameter.Example traffic policyThe following example traffic policy creates a weighted record that points to two endpoints.This policy specifies the following values:The current policy format version (AWSPolicyFormatVersion)The record type (RecordType)Note: Configure this value based on your endpoint type. In this example, the record type is A.Two endpoints (EndPointReference) that point to IP addresses (Type)Weighted rules (RuleType) and a different weight for each endpoint (Weight)The traffic policy's starting pointNote: In the following example, StartRule specifies the policy starts with a rule instead of an endpoint (StartEndpoint).The health check setting (EvaluateTargetHealth)Note: You can configure this setting with HealthCheck. The following example does not perform a health check.{  "AWSPolicyFormatVersion": "2015-10-01",  "RecordType": "A",  "Endpoints": {    "endpoint-1": {      "Type": "value",      "Value": "192.0.1.1"      },    "endpoint-2": {      "Type": "value",      "Value": "192.0.1.2"      }    },  "Rules": {    "weighted-rule-name": {      "RuleType": "weighted",      "Items": [        {"Weight": "30",        "EvaluateTargetHealth": true,        "EndpointReference": "endpoint-1"        },        {"Weight": "20",        "EvaluateTargetHealth": false,        "EndpointReference": "endpoint-2"        }      ]    }  },  "StartRule": "weighted-rule-name"}Related InformationSupported DNS record typesFollow"