Transaction: 4ad741bdc323a07913f8319f505584552895169c

Included in block 12,898,254 at 2017/06/17 11:19:39 (UTC).

Transaction overview

Loading...
Transaction info
transaction_id 4ad741bdc323a07913f8319f505584552895169c
ref_block_num 53,194
block_num12,898,254
ref_block_prefix 2,504,946,135
expiration2017/06/17T11:20:36
transaction_num 4
extensions[]
signatures 1f137d6bbc1713ad59d678129ed5670869fb5bd6f4deb1ba41a4c5764c85fab4863143fd0f917781e43a5f8f590630e4d5ab8249d0a1bad7253482bb6986bb50d9
operations
comment
"parent_author":"",<br>"parent_permlink":"programming",<br>"author":"kalomeister",<br>"permlink":"create-your-own-dynamic-dns-service-with-aws-sdk-and-route53-using-c",<br>"title":"Create your own dynamic dns service with AWS SDK and Route53 using C#",<br>"body":"<html>\n<p>&nbsp;I have several webservers running various services and websites but I had a need one of the servers to be aware of an ip address which is dynamic. I looked at dyndns service which I thought it would be free but to my surprise I had to pay $40 per year,<br> which in my case wasn\u2019t a good option. So,<br> since I\u2019m using from Amazon\u2019s several cloud services,<br> I thought,<br> why not creating my own dynamic dns service utilizing the Amazon Route 53 highly available and scalable cloud Domain Name System web service? The implementation of it was much more simple that I thought.All I had to do find my external IP address,<br> the one that is assigned from my ISP to my device and then use the Amazon SDK for Route53 to update my DNS records.Prior using the code you will need to have<\/p>\n<ul>\n <li>an AWS account<\/li>\n <li>a domain name<\/li>\n <li>a hosted zone with Route53<\/li>\n <li>an IAM user with the appropriate permissions set.<\/li>\n<\/ul>\n<p>To create the IAM user with the right permissions for this post follow the below steps.Go to Amazon console,<br> select the IAM Service and add a new user,<br> setting your desired user name,<br> make sure in the access type section you have the <strong>Programmatic Access<\/strong> <em><strong>checked<\/strong><\/em> and click on the button <strong>Next: Permissions<\/strong>&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_HostedZones-1024x135.png\" width=\"1024\" height=\"135\"\/><\/p>\n<p>&nbsp;At this stage leave everything as is and click on the <strong>Next: Review<\/strong> button to create the user with no policies attached to it,<br> and then click on the <strong>Create User<\/strong> button.Note down the <strong>Access Key<\/strong> and the <strong>Secret Key<\/strong> that is generated by the system.Now go to IAM user initial screen and select <strong>Policies,<br>&nbsp;<\/strong>click on the <strong>Create Policy<\/strong> button and select the <strong>Policy Generator<\/strong>&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_CreatePolicy-1.png\" width=\"897\" height=\"268\"\/><\/p>\n<p>&nbsp;You should see the screen for editing permissions.<\/p>\n<ul>\n <li><strong>Effect<\/strong> is set to <em><strong>Allow<\/strong><\/em><\/li>\n <li><strong>AWS Service<\/strong> dropdown selection is set to <strong>Amazon Route53<\/strong><\/li>\n <li>For the <strong>Actions<\/strong> you will only need to select 2 options,<br> the <strong>ChangeResourceRecodsets<\/strong> and the <strong>GetChange<\/strong><\/li>\n<\/ul>\n<p>After you set the values click on the <strong>Add Statement<\/strong> button and then to <strong>Next Step<\/strong> button to go to Review Policy section.&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_EditPermissions-1.png\" width=\"911\" height=\"349\"\/><\/p>\n<p><br><\/p>\n<p>&nbsp;In the <strong>Policy Review<\/strong> section set the policy name or leave it default as is,<br> the choice is yours.<br>\nAdd a description to the policy if you want,<br> this is optional.<br>\nDo not amend the policy document unless you know what you are doing,<br> your policy should look like below.<\/p>\n<p>&nbsp;<\/p>\n<pre><code> <br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;\"Version\": \"2012-10-17\",<br><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;\"Statement\": [<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp; <br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"Sid\": \"Stmt1481207429000\",<br><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"Effect\": \"Allow\",<br><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"Action\": [<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"route53:ChangeResourceRecordSets\",<br><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"route53:GetChange\"<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp; ,<br><br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"Resource\": [<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;\"*\"<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp; <br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n<br>\n <\/code><\/pre>\n<p>Click on the Create Policy button.<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_Review-1.png\" width=\"779\" height=\"290\"\/><\/p>\n<p><br><\/p>\n<p>&nbsp;Now go back to the list of the IAM users and click on the user you created earlier and then to <strong>Add Persmissions<\/strong> button.&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_AddPermission-1.png\" width=\"842\" height=\"298\"\/><\/p>\n<p>&nbsp;In the Set Permissions screen select the <strong>Attach Existing Policies Directly,<br><\/strong> select the policy you just created from the Available Policies and click on the <strong>Next:Review<\/strong> button.&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_Select-1.png\" width=\"735\" height=\"376\"\/><\/p>\n<p>&nbsp;Review the permissions you selected and click on <strong>Add Permissions<\/strong> button&nbsp;<\/p>\n<p><img src=\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_ReviewAndAddPermission-1.png\" width=\"747\" height=\"191\"\/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Now it is time to get dirty!<\/strong>Open the Visual Studio,<br> create your project and to install the AWS SDK for Route 53 run the following command in the <strong>Package Manager<\/strong><\/p>\n<p><code>Install-Package AWSSDK.Route53<\/code><br>\nThis statement will add the required references to your project for using the AWSSDK.Next add the below class to your project,<br> the code is very simplistic for the purpose of this article and to understand how the AWS Route53 API works.<\/p>\n<p><br><\/p>\n<pre><code>using System;<br>\n<br>\n<br>\n<br>\nusing System.Collections.Generic;<br>\n<br>\n<br>\n<br>\nusing System.Threading;<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\nusing Amazon;<br>\n<br>\n<br>\n<br>\nusing Amazon.Route53;<br>\n<br>\n<br>\n<br>\nusing Amazon.Route53.Model;<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\nnamespace My.DynDns<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;public class Recordset<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp; <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private string _profile;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public string Profile set _profile = value; <br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private string _hostedZoneID;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public string HostedZoneID set _hostedZoneID = value; <br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private string _accessKeyID;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public string AccessKeyID set _accessKeyID = value; <br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private string _secretKey;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public string SecretKey set _secretKey = value; <br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public void UpdateIP(string recordName,<br> string ipAddress,<br> <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RegionEndpoint regionEndPoint,<br> RRType recordsetType,<br> <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;long timeToLiveSeconds = 300)<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/You can eliminate the Profile Manager from the code and simply use <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/the web.config or app.config to store the Access Key and Secret Key<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/Read further at https:\/\/goo.gl\/KnWMPC<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!Amazon.Util.ProfileManager.IsProfileKnown(_profile))<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amazon.Util.ProfileManager.RegisterProfile(_profile,<br> _accessKeyID,<br> _secretKey);<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var credentials = new Amazon.Runtime.StoredProfileAWSCredentials(_profile);<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var clientConfig = new AmazonRoute53Config();<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clientConfig.RegionEndpoint = regionEndPoint;<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var route53Client = new AmazonRoute53Client(credentials,<br> clientConfig);<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ChangeResourceRecordSetsRequest crrsr = new ChangeResourceRecordSetsRequest();<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crrsr.HostedZoneId = _hostedZoneID;<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change change = new Change();<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.Action = ChangeAction.UPSERT;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.ResourceRecordSet = new ResourceRecordSet();<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.ResourceRecordSet.Name = recordName;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.ResourceRecordSet.Type = recordsetType;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.ResourceRecordSet.TTL = timeToLiveSeconds;<br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change.ResourceRecordSet.ResourceRecords.Add(new ResourceRecord Value = ipAddress );<br>\n<br>\n<br>\n<br>\n <br>\n<br>\n<br>\n<br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;Change&gt; changes = new List&lt;Change&gt;();<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changes.Add(change);<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ChangeBatch changeBatch = new ChangeBatch();<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changeBatch.Changes = changes;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changeBatch.Comment = string.Format(\"IP Changed at 0 UTC\" + DateTime.UtcNow.ToString());<br>\n<br>\n&nbsp;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;crrsr.ChangeBatch = changeBatch;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var recordsetResponse = route53Client.ChangeResourceRecordSets(crrsr);<br>\n<br>\n&nbsp;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var changeRequest = new GetChangeRequest() Id = recordsetResponse.ChangeInfo.Id ;<br>\n<br>\n&nbsp;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (ChangeStatus.PENDING == route53Client.GetChange(changeRequest).ChangeInfo.Status)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/If the change status is pending wait for 15 seconds before checking again.<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread.Sleep(15000);<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch (AmazonRoute53Exception ex)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw ex;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch(Exception ex)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw ex;<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp; <br>\n<br>\n <\/code><\/pre>\n<p>&nbsp;To use the above code simply create instance of the class Recordset set the profile name,<br> access key,<br> secret key and call the method UpdateIP passing in the arguments the record name,<br> the new ip address,<br> the region end point where you hosted zone is,<br> the record type and the TTL value in seconds.&nbsp;<\/p>\n<p><br><\/p>\n<pre><code>try<br>\n <br>\n &nbsp;&nbsp;&nbsp;My.DynDns.Recordset r = new My.DynDns.Recordset();<br>\n &nbsp;&nbsp;&nbsp;r.HostedZoneID = \"MyHosteZoneId\";<br>\n &nbsp;&nbsp;&nbsp;r.Profile = \"myprofilename\";<br>\n &nbsp;&nbsp;&nbsp;r.AccessKeyID = \"MyAccessID\";<br>\n &nbsp;&nbsp;&nbsp;r.SecretKey = \"MySecretKey\";<br>\n &nbsp;&nbsp;&nbsp;r.UpdateIP(\"nycname.example.com\",<br> \"123.123.1.100\",<br><br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Amazon.RegionEndpoint.USEast2,<br> Amazon.Route53.RRType.A,<br><br>\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;300);<br>\n &nbsp;&nbsp;&nbsp;Console.WriteLine(\"Recordset updated successfully\");<br>\n <br>\ncatch(Exception ex)<br>\n <br>\n &nbsp;&nbsp;&nbsp;Console.WriteLine(ex.Message);<br>\n <\/code><\/pre>\n<p>&nbsp;Now you should be able to update you DNS records in AWS Route53 through you application,<br> service or however you decide to use the code published in this article.<\/p>\n<p>I'd love to here from you,<br> if you are using any of the AWS service and how?<\/p>\n<p>First published at <a href=\"https:\/\/www.kalomeister.net\/create-dynamic-dns-service-aws-sdk-route53\/\">kalomeister.net<\/a>&nbsp;<\/p>\n<p><br><\/p>\n<\/html>",<br>"json_metadata":" \"tags\":[\"programming\" ,<br>\"image\":[\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_HostedZones-1024x135.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_CreatePolicy-1.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_EditPermissions-1.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_Review-1.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_AddPermission-1.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_Select-1.png\",<br>\"https:\/\/www.kalomeister.net\/wp-content\/uploads\/2016\/12\/MyDynDns_IAMUser_Policy_ReviewAndAddPermission-1.png\" ,<br>\"links\":[\"https:\/\/www.kalomeister.net\/create-dynamic-dns-service-aws-sdk-route53\/\" ,<br>\"app\":\"steemit\/0.1\",<br>\"format\":\"html\" "
vote
"voter":"kalomeister",
"author":"kalomeister",
"permlink":"create-your-own-dynamic-dns-service-with-aws-sdk-and-route53-using-c",
"weight":10000
* The API used to generate this page is provided by @steemchiller.