AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

A complex type containing the response for the request.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.Route53.Model.ChangeResourceRecordSetsResponse

Namespace: Amazon.Route53.Model
Assembly: AWSSDK.Route53.dll
Version: 3.x.y.z

Syntax

C#
public class ChangeResourceRecordSetsResponse : AmazonWebServiceResponse

The ChangeResourceRecordSetsResponse type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property ChangeInfo Amazon.Route53.Model.ChangeInfo

Gets and sets the property ChangeInfo.

A complex type that contains information about changes made to your hosted zone.

This element contains an ID that you use when performing a GetChange action to get detailed information about the change.

Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.

Examples

This example shows how to create an Amazon Route 53 hosted zone and add a resource record set to the zone.

Create a hosted zone and add a resource record set

string domainName = "www.example.org";

IAmazonRoute53 route53Client = new AmazonRoute53Client();

CreateHostedZoneRequest zoneRequest = new CreateHostedZoneRequest
{
  Name = domainName,
  CallerReference = "my_change_request"
};

CreateHostedZoneResponse zoneResponse = route53Client.CreateHostedZone(zoneRequest);

ResourceRecordSet recordSet = new ResourceRecordSet
{
  Name = domainName,
  TTL = 60,
  Type = RRType.A,
  ResourceRecords = new List { new ResourceRecord { Value = "192.0.2.235" } }
};

Change change1 = new Change
{
  ResourceRecordSet = recordSet,
  Action = ChangeAction.CREATE
};

ChangeBatch changeBatch = new ChangeBatch
{
  Changes = new List { change1 }
};

ChangeResourceRecordSetsRequest recordsetRequest = new ChangeResourceRecordSetsRequest
{
  HostedZoneId = zoneResponse.HostedZone.Id,
  ChangeBatch = changeBatch
};

ChangeResourceRecordSetsResponse recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest);

GetChangeRequest changeRequest = new GetChangeRequest
{
  Id = recordsetResponse.ChangeInfo.Id
};

while (route53Client.GetChange(changeRequest).ChangeInfo.Status == ChangeStatus.PENDING)
{
  Console.WriteLine("Change is pending.");
  Thread.Sleep(TimeSpan.FromSeconds(15));
}
      

The following example creates a resource record set that routes Internet traffic to a resource with an IP address of 192.0.2.44.

To create a basic resource record set


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.44" }
                    },
                    TTL = 60,
                    Type = "A"
                }
            }
        },
        Comment = "Web server for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE"
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates two weighted resource record sets. The resource with a Weight of 100 will get 1/3rd of traffic (100/100+200), and the other resource will get the rest of the traffic for example.com.

To create weighted resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba",
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.44" }
                    },
                    SetIdentifier = "Seattle data center",
                    TTL = 60,
                    Type = "A",
                    Weight = 100
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba",
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.45" }
                    },
                    SetIdentifier = "Portland data center",
                    TTL = 60,
                    Type = "A",
                    Weight = 200
                }
            }
        },
        Comment = "Web servers for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE"
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates an alias resource record set that routes traffic to a CloudFront distribution.

To create an alias resource record set


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "d123rk29d0stfj.cloudfront.net",
                        EvaluateTargetHealth = false,
                        HostedZoneId = "Z2FDTNDATAQYW2"
                    },
                    Name = "example.com",
                    Type = "A"
                }
            }
        },
        Comment = "CloudFront distribution for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates two weighted alias resource record sets that route traffic to ELB load balancers. The resource with a Weight of 100 will get 1/3rd of traffic (100/100+200), and the other resource will get the rest of the traffic for example.com.

To create weighted alias resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z3AADJGX6KTTL2"
                    },
                    Name = "example.com",
                    SetIdentifier = "Ohio region",
                    Type = "A",
                    Weight = 100
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z1H1FL5HABSF5"
                    },
                    Name = "example.com",
                    SetIdentifier = "Oregon region",
                    Type = "A",
                    Weight = 200
                }
            }
        },
        Comment = "ELB load balancers for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates two latency resource record sets that route traffic to EC2 instances. Traffic for example.com is routed either to the Ohio region or the Oregon region, depending on the latency between the user and those regions.

To create latency resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba",
                    Name = "example.com",
                    Region = "us-east-2",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.44" }
                    },
                    SetIdentifier = "Ohio region",
                    TTL = 60,
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba",
                    Name = "example.com",
                    Region = "us-west-2",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.45" }
                    },
                    SetIdentifier = "Oregon region",
                    TTL = 60,
                    Type = "A"
                }
            }
        },
        Comment = "EC2 instances for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE"
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates two latency alias resource record sets that route traffic for example.com to ELB load balancers. Requests are routed either to the Ohio region or the Oregon region, depending on the latency between the user and those regions.

To create latency alias resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z3AADJGX6KTTL2"
                    },
                    Name = "example.com",
                    Region = "us-east-2",
                    SetIdentifier = "Ohio region",
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z1H1FL5HABSF5"
                    },
                    Name = "example.com",
                    Region = "us-west-2",
                    SetIdentifier = "Oregon region",
                    Type = "A"
                }
            }
        },
        Comment = "ELB load balancers for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates primary and secondary failover resource record sets that route traffic to EC2 instances. Traffic is generally routed to the primary resource, in the Ohio region. If that resource is unavailable, traffic is routed to the secondary resource, in the Oregon region.

To create failover resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    Failover = "PRIMARY",
                    HealthCheckId = "abcdef11-2222-3333-4444-555555fedcba",
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.44" }
                    },
                    SetIdentifier = "Ohio region",
                    TTL = 60,
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    Failover = "SECONDARY",
                    HealthCheckId = "abcdef66-7777-8888-9999-000000fedcba",
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.45" }
                    },
                    SetIdentifier = "Oregon region",
                    TTL = 60,
                    Type = "A"
                }
            }
        },
        Comment = "Failover configuration for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE"
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates primary and secondary failover alias resource record sets that route traffic to ELB load balancers. Traffic is generally routed to the primary resource, in the Ohio region. If that resource is unavailable, traffic is routed to the secondary resource, in the Oregon region.

To create failover alias resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z3AADJGX6KTTL2"
                    },
                    Failover = "PRIMARY",
                    Name = "example.com",
                    SetIdentifier = "Ohio region",
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-987654321.us-west-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z1H1FL5HABSF5"
                    },
                    Failover = "SECONDARY",
                    Name = "example.com",
                    SetIdentifier = "Oregon region",
                    Type = "A"
                }
            }
        },
        Comment = "Failover alias configuration for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates four geolocation resource record sets that use IPv4 addresses to route traffic to resources such as web servers running on EC2 instances. Traffic is routed to one of four IP addresses, for North America (NA), for South America (SA), for Europe (EU), and for all other locations (*).

To create geolocation resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    GeoLocation = new GeoLocation { ContinentCode = "NA" },
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.44" }
                    },
                    SetIdentifier = "North America",
                    TTL = 60,
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    GeoLocation = new GeoLocation { ContinentCode = "SA" },
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.45" }
                    },
                    SetIdentifier = "South America",
                    TTL = 60,
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    GeoLocation = new GeoLocation { ContinentCode = "EU" },
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.46" }
                    },
                    SetIdentifier = "Europe",
                    TTL = 60,
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    GeoLocation = new GeoLocation { CountryCode = "*" },
                    Name = "example.com",
                    ResourceRecords = new List {
                        new ResourceRecord { Value = "192.0.2.47" }
                    },
                    SetIdentifier = "Other locations",
                    TTL = 60,
                    Type = "A"
                }
            }
        },
        Comment = "Geolocation configuration for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE"
});

ChangeInfo changeInfo = response.ChangeInfo;

            

The following example creates four geolocation alias resource record sets that route traffic to ELB load balancers. Traffic is routed to one of four IP addresses, for North America (NA), for South America (SA), for Europe (EU), and for all other locations (*).

To create geolocation alias resource record sets


var response = client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest 
{
    ChangeBatch = new ChangeBatch {
        Changes = new List {
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-123456789.us-east-2.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z3AADJGX6KTTL2"
                    },
                    GeoLocation = new GeoLocation { ContinentCode = "NA" },
                    Name = "example.com",
                    SetIdentifier = "North America",
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-234567890.sa-east-1.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z2P70J7HTTTPLU"
                    },
                    GeoLocation = new GeoLocation { ContinentCode = "SA" },
                    Name = "example.com",
                    SetIdentifier = "South America",
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-234567890.eu-central-1.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z215JYRZR1TBD5"
                    },
                    GeoLocation = new GeoLocation { ContinentCode = "EU" },
                    Name = "example.com",
                    SetIdentifier = "Europe",
                    Type = "A"
                }
            },
            new Change {
                Action = "CREATE",
                ResourceRecordSet = new ResourceRecordSet {
                    AliasTarget = new AliasTarget {
                        DNSName = "example-com-234567890.ap-southeast-1.elb.amazonaws.com ",
                        EvaluateTargetHealth = true,
                        HostedZoneId = "Z1LMS91P8CMLE5"
                    },
                    GeoLocation = new GeoLocation { CountryCode = "*" },
                    Name = "example.com",
                    SetIdentifier = "Other locations",
                    Type = "A"
                }
            }
        },
        Comment = "Geolocation alias configuration for example.com"
    },
    HostedZoneId = "Z3M3LMPEXAMPLE" // Depends on the type of resource that you want to route traffic to
});

ChangeInfo changeInfo = response.ChangeInfo;

            

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms