Reputation: 143
I want to create a A type of record having multiple IPs in aws route53 using aws cli. I didn't find exact command . Can somebody help me.
example. demoHC.hc.xyz.com should have 2-3 IP
Upvotes: 1
Views: 3055
Reputation: 495
You must create multiple Value
records:
{
"Changes":[
{
"Action":"CREATE",
"ResourceRecordSet":{
"Name":"anujhc.hc.xyz.com",
"Type":"A",
"TTL":300,
"ResourceRecords":[
{
"Value":"1.2.3.4"
},
{
"Value":"8.8.8.8"
},
{
"Value":"123.123.123.123"
}
]
}
}
]
}
Upvotes: 2
Reputation: 338
The command is create-traffic-policy (https://docs.aws.amazon.com/cli/latest/reference/route53/create-traffic-policy.html)
Part of the traffic policy includes how you want to distribute traffic (you have a few options including weighted or via geolocation) the simplest way is a round robin approach, where you have equally weighted endpoints.
Here's some code, taken from (https://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html#traffic-policy-document-format-examples)
{
"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"
}
]
}
}
}
since you're going to need to pass in json you might benefit from this https://docs.aws.amazon.com/cli/latest/userguide/generate-cli-skeleton.html
Upvotes: 0