User guide

Table Of Contents
4. Monitor the change to verify that it is complete.
The example is a simple console application that shows how to use the SDK for .NET to implement this
procedure for a basic record set.
To run this example
1. In the Visual Studio File menu, click New and then click Project.
2. Select the AWS Empty Project template and specify the project's name and location.
3. Specify the application's default credentials profile and AWS region, which are added to the project's
App.config file.This example assumes that the region is set to US East (Northern Virginia) and
the profile is set to default. For more information on profiles, see Configuring AWS Credentials (p. 9).
4. Open program.cs and replace the using declarations and the code in Main with the corresponding
code from the following example. If you are using your default credentials profile and region, you can
compile and run the application as-is. Otherwise, you must provide an appropriate profile and region,
as discussed in the notes that follow the example.
using System;
using System.Collections.Generic;
using System.Threading;
using Amazon;
using Amazon.Route53;
using Amazon.Route53.Model;
namespace Route53_RecordSet
{
//Create a hosted zone and add a basic record set to it
class recordset
{
public static void Main(string[] args)
{
string domainName = "www.example.org";
//[1] Create an Amazon Route 53 client object
IAmazonRoute53 route53Client = AWSClientFactory.CreateAmazonRoute53Cli
ent();
//[2] Create a hosted zone
CreateHostedZoneRequest zoneRequest = new CreateHostedZoneRequest()
{
Name = domainName,
CallerReference = "my_change_request"
};
CreateHostedZoneResponse zoneResponse = route53Client.CreateHostedZone(zone
Request);
//[3] Create a resource record set change batch
ResourceRecordSet recordSet = new ResourceRecordSet()
{
Name = domainName,
TTL = 60,
Type = RRType.A,
Version v2.0.0
64
AWS SDK for .NET Developer Guide
Updating Amazon Route 53 Resource Record Sets