Norway


route53  - route53 - #Backup #AWS #Route53 DNS Zones in C#

If you host your on Amazon , and it’s reasonably complex, it’s worthwhile taking a of it, so that future errors can be undone quickly. There are some tools to do it, however, you can also write a script yourself in C# to do it.

First off, get the NUGET package

Install-Package AWSSDK

Create an IAM user within with programmatic access, and get it’s Access and Secret ID. – I’ve given it Administrator access, but you should limit the scope to the minimum.

Then I output all the to the console here;

var client = AWSClientFactory.CreateAmazonRoute53Client(“***”, “***”, RegionEndpoint.USEast1);
var zones = client.ListHostedZones();
foreach(HostedZone zone in zones.HostedZones)
{
Console.WriteLine(zone.Name);
var recordSets = client.ListResourceRecordSets(new ListResourceRecordSetsRequest() { HostedZoneId = zone.Id });
foreach(var record in recordSets.ResourceRecordSets)
{
Console.WriteLine(“t” + record.Name + ” (” + record.Type + “)”);
foreach(var resource in record.ResourceRecords)
{
Console.WriteLine(“tt” + resource.Value);
}
}
}

 



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here