jeudi 27 août 2015

Trying to get a COMPLETE list of AWS Route53 records. How to get more than the first 100?

I am trying to list records on route53 that we have but am failing to get more than the first 100 results! How can I list ALL of them? How can I also filter the results to list only those with a specific RecordType?

This is the code I tried running but I fail to get a complete list…:

string recordList = "";
int ii = 0;
ListResourceRecordSetsResponse result = r53client.ListResourceRecordSets(request);
System.Windows.Forms.MessageBox.Show(result.ListResourceRecordSetsResult.ResourceRecordSets.Count+" records!");
while (result.ListResourceRecordSetsResult.ResourceRecordSets.Count > 0)
{
    foreach (var recordSet in result.ListResourceRecordSetsResult.ResourceRecordSets)
    {
        if (recordSet.Type == "CNAME")
        {
            foreach (var resourceRecord in recordSet.ResourceRecords)
            {

                recordList += resourceRecord.Value + "\n";
                jj++;
                // set first record to get next, as the last one we already got!
                request.StartRecordName = resourceRecord.Value;
            }

        }
    }
result = r53client.ListResourceRecordSets(request);

}




Aucun commentaire:

Enregistrer un commentaire