I have a Jenkins pipeline that will start my AWS Ubuntu EC2 instances. This Jenkins pipeline will also update a CNAME record I have for my EC2 instances in route53.
Sometimes there is a long delay in my ability to ssh to the instance via the CNAME. I figured it might be a cache issue, but if I execute dig the-cname.example.com
I see the updated versions of the DNS records. Also I have no problem ssh'ing to the new IP and the value of the DNS A
record that AWS gave my instance.
Is my ssh client using a cached version of the CNAME?
dig
performs an actual DNS query, whilessh
will simply ask your system (most likely throughgethostbyname
) to resolve a name.dig
will ask an actual DNS server whilessh
will ask the local service in charge of DNS (nowadays, most likely systemd-resolve) which will cache results.If using systemd, you can clear the cash using
systemd-resolve flush-caches
.