I have a hosted zone and record set that route to multiple addresses. I'd like to update the record set with adding or removing one IP address in the list. Unfortunately, AWS CLI doesn't provide the option of deleting/adding the value of resource record in route53
{
"Comment": "Update the A record set",
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "mydomain.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{
"Value": "XX.XX.XX.XX"
}
]
}
}
]
}
I can add multiple IP addresses into your json like this manually. But I want to add multiple IPs to the json file using bash automatically.
{
"Comment": "Update the A record set",
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "mydomain.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [{
"Value": "XX.XX.XX.XX"
},
{
"Value": "XX.XX.XX.XX"
}
]
}
}]
}
jq
is the definite tool for it. If you want to produce a production-level tool to do this automatically and reliably you should try a language like Python or Ruby - they are much better suited for dealing with nested data structures. – l0b0 Feb 14 '19 at 2:54