Google Cloud DNS changing Record Resource update time











up vote
1
down vote

favorite












I am currently trying to map a Compute Engine VM with an ephemeral IP to a hostname using Google Cloud DNS, this operation takes place at the VM startup time. I am doing this through a shell script as it follows:



gcloud dns record-sets transaction start -z=MY_ZONE
gcloud dns record-sets transaction remove --zone MY_ZONE
--name subd.domain.com
--type A "1.2.3.4" #the old external ip for the VM
--ttl 300
gcloud dns record-sets transaction add --zone MY_ZONE
--name subd.domain.com
--type A "5.6.7.8" #the new external ip for the VM
--ttl 300
gcloud dns record-sets transaction execute -z=MY_ZONE


After the script is run I can see the records successfully changed in the Cloud DNS UI, with the "A" RR having the new external IP.



What happens now is that it takes a really long time for these changes to really go live. Accessing the hostname "subd.domain.com" after the change returns an "NXDOMAIN" status lasting a long period of time and only after that it finally maps the domain to the new IP.



This situation raised two questions for me:



#1 Why does the DNS go through the NXDOMAIN phase? Shouldn't those changes act as an Update(due to running this in a transaction) and not as a Remove then Create.



#2 What determines the time for this record update to go live?










share|improve this question


















  • 1




    How do you test if changes really went live, and what is "a long period of time"?
    – Dusan Bajic
    Nov 15 at 14:08










  • accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
    – Brad
    Nov 15 at 14:28






  • 1




    I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
    – John Hanley
    Nov 19 at 23:22










  • @JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
    – Brad
    Nov 20 at 12:02















up vote
1
down vote

favorite












I am currently trying to map a Compute Engine VM with an ephemeral IP to a hostname using Google Cloud DNS, this operation takes place at the VM startup time. I am doing this through a shell script as it follows:



gcloud dns record-sets transaction start -z=MY_ZONE
gcloud dns record-sets transaction remove --zone MY_ZONE
--name subd.domain.com
--type A "1.2.3.4" #the old external ip for the VM
--ttl 300
gcloud dns record-sets transaction add --zone MY_ZONE
--name subd.domain.com
--type A "5.6.7.8" #the new external ip for the VM
--ttl 300
gcloud dns record-sets transaction execute -z=MY_ZONE


After the script is run I can see the records successfully changed in the Cloud DNS UI, with the "A" RR having the new external IP.



What happens now is that it takes a really long time for these changes to really go live. Accessing the hostname "subd.domain.com" after the change returns an "NXDOMAIN" status lasting a long period of time and only after that it finally maps the domain to the new IP.



This situation raised two questions for me:



#1 Why does the DNS go through the NXDOMAIN phase? Shouldn't those changes act as an Update(due to running this in a transaction) and not as a Remove then Create.



#2 What determines the time for this record update to go live?










share|improve this question


















  • 1




    How do you test if changes really went live, and what is "a long period of time"?
    – Dusan Bajic
    Nov 15 at 14:08










  • accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
    – Brad
    Nov 15 at 14:28






  • 1




    I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
    – John Hanley
    Nov 19 at 23:22










  • @JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
    – Brad
    Nov 20 at 12:02













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am currently trying to map a Compute Engine VM with an ephemeral IP to a hostname using Google Cloud DNS, this operation takes place at the VM startup time. I am doing this through a shell script as it follows:



gcloud dns record-sets transaction start -z=MY_ZONE
gcloud dns record-sets transaction remove --zone MY_ZONE
--name subd.domain.com
--type A "1.2.3.4" #the old external ip for the VM
--ttl 300
gcloud dns record-sets transaction add --zone MY_ZONE
--name subd.domain.com
--type A "5.6.7.8" #the new external ip for the VM
--ttl 300
gcloud dns record-sets transaction execute -z=MY_ZONE


After the script is run I can see the records successfully changed in the Cloud DNS UI, with the "A" RR having the new external IP.



What happens now is that it takes a really long time for these changes to really go live. Accessing the hostname "subd.domain.com" after the change returns an "NXDOMAIN" status lasting a long period of time and only after that it finally maps the domain to the new IP.



This situation raised two questions for me:



#1 Why does the DNS go through the NXDOMAIN phase? Shouldn't those changes act as an Update(due to running this in a transaction) and not as a Remove then Create.



#2 What determines the time for this record update to go live?










share|improve this question













I am currently trying to map a Compute Engine VM with an ephemeral IP to a hostname using Google Cloud DNS, this operation takes place at the VM startup time. I am doing this through a shell script as it follows:



gcloud dns record-sets transaction start -z=MY_ZONE
gcloud dns record-sets transaction remove --zone MY_ZONE
--name subd.domain.com
--type A "1.2.3.4" #the old external ip for the VM
--ttl 300
gcloud dns record-sets transaction add --zone MY_ZONE
--name subd.domain.com
--type A "5.6.7.8" #the new external ip for the VM
--ttl 300
gcloud dns record-sets transaction execute -z=MY_ZONE


After the script is run I can see the records successfully changed in the Cloud DNS UI, with the "A" RR having the new external IP.



What happens now is that it takes a really long time for these changes to really go live. Accessing the hostname "subd.domain.com" after the change returns an "NXDOMAIN" status lasting a long period of time and only after that it finally maps the domain to the new IP.



This situation raised two questions for me:



#1 Why does the DNS go through the NXDOMAIN phase? Shouldn't those changes act as an Update(due to running this in a transaction) and not as a Remove then Create.



#2 What determines the time for this record update to go live?







shell dns google-compute-engine google-cloud-dns






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 at 11:57









Brad

1549




1549








  • 1




    How do you test if changes really went live, and what is "a long period of time"?
    – Dusan Bajic
    Nov 15 at 14:08










  • accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
    – Brad
    Nov 15 at 14:28






  • 1




    I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
    – John Hanley
    Nov 19 at 23:22










  • @JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
    – Brad
    Nov 20 at 12:02














  • 1




    How do you test if changes really went live, and what is "a long period of time"?
    – Dusan Bajic
    Nov 15 at 14:08










  • accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
    – Brad
    Nov 15 at 14:28






  • 1




    I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
    – John Hanley
    Nov 19 at 23:22










  • @JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
    – Brad
    Nov 20 at 12:02








1




1




How do you test if changes really went live, and what is "a long period of time"?
– Dusan Bajic
Nov 15 at 14:08




How do you test if changes really went live, and what is "a long period of time"?
– Dusan Bajic
Nov 15 at 14:08












accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
– Brad
Nov 15 at 14:28




accesing this console.cloud.google.com/net-services/dns/zones?project=*PROJECT_NAME*, a long period of time in this case is 1-2 hours
– Brad
Nov 15 at 14:28




1




1




I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
– John Hanley
Nov 19 at 23:22




I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.
– John Hanley
Nov 19 at 23:22












@JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
– Brad
Nov 20 at 12:02




@JohnHanley Thank you very much for your response, this I have also come to this conclusion. Could you please consider adding this as an answer?
– Brad
Nov 20 at 12:02












1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.



When planning for DNS changes, I plan for minimum of 48 hours for the change to take effect. This means that we maintain services on the old DNS entry while the new DNS entry takes effect.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319001%2fgoogle-cloud-dns-changing-record-resource-update-time%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.



    When planning for DNS changes, I plan for minimum of 48 hours for the change to take effect. This means that we maintain services on the old DNS entry while the new DNS entry takes effect.






    share|improve this answer

























      up vote
      2
      down vote



      accepted










      I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.



      When planning for DNS changes, I plan for minimum of 48 hours for the change to take effect. This means that we maintain services on the old DNS entry while the new DNS entry takes effect.






      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.



        When planning for DNS changes, I plan for minimum of 48 hours for the change to take effect. This means that we maintain services on the old DNS entry while the new DNS entry takes effect.






        share|improve this answer












        I will offer this suggestion based upon decades of DNS experience. Don't treat DNS as your on-demand database. The DNS ecosystem is not designed to support what you are trying to do. Each link in the chain caches DNS entries. You have no control over this process. In your example your TTL is 300 seconds. It will take as least 5 minutes before the next server above yours expires your entries. A lot of caches ignore your TTL and set it to hours or sometimes even days. You need to design your DNS setup to be "eventually consistent" and not "instantly consistent". Eventually means hours or days.



        When planning for DNS changes, I plan for minimum of 48 hours for the change to take effect. This means that we maintain services on the old DNS entry while the new DNS entry takes effect.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 18:05









        John Hanley

        12.1k2527




        12.1k2527






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53319001%2fgoogle-cloud-dns-changing-record-resource-update-time%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Can I use Tabulator js library in my java Spring + Thymeleaf project?