Womble
Womble

Reputation: 67

Adding Multiple MX Records via AWS Route53 - changeResourceRecordSet - PHP

I'm having a problem with the changeResourceRecordSets API call.

My record has multiple MX values. When I call the API I can get it to add 1 MX record, but I cannot get it to add multiple values.

For example:

   ['ResourceRecordSet']['Name'] = 'mytest.com'; 
   ['ResourceRecordSet']['Type'] = 'MX';
   ['ResourceRecordSet']['TTL'] = 3600;
   ['ResourceRecordSet']['ResourceRecords']['Value'] = array("Value"=>'10 mx1.emailsrvr.com');

Works for one record.

I've tried:

   ['ResourceRecordSet']['ResourceRecords']['Value'] = array("Value"=>'10 mx1.emailsrvr.com', '20 mx2.emailsrvr.com');

But this will only add one record, not both.

How do I add both records?

Upvotes: 2

Views: 2255

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

The official AWS documentation states that each value would be its own array, so the structure would look similar to the below

['ResourceRecordSet']['ResourceRecords'][] = array("Value"=>'10 mx1.emailsrvr.com');
['ResourceRecordSet']['ResourceRecords'][] = array("Value"=>'5 mx2.emailsrvr.com');

ResourceRecords is actually an array of values, rather than needing a key of "Value". Each of these will be looped over and added to your record.

Upvotes: 1

Related Questions