<p>It could be due to a &quot;VPC DNS throttling&quot;, you can find more information on the official documentation.</p>
<p><a href="https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-cause-of-failed-dns-queries/" rel="nofollow noreferrer">https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-cause-of-failed-dns-queries/</a></p>

CC BY-SA 4.0
2021-04-04T05:50:58.637Z
It can also be an issue if the OP is using some form of third-party DNS resolver, such as Microsoft AD Domain Controller (i.e. if the environment relies on AD or LDAP).  Generally, public DNS services such as Google or Cloudflare are going to be good, but a misconfigured localdomain DNS host can cause tons of problems.
maplebird
CC BY-SA 4.0
2021-03-27T07:31:19.763Z
2021-03-27T07:31:19.763Z
Hik
<h2>The Problem &amp; The Question</h2>
<p>I'm trying to create an AWS ElastiCache Redis-flavored cluster and connect to it from an instance in the same VPC. When I create the cluster initially, I can connect to it just fine via <code>redis-cli</code>. If I wait a day or two and then try to connect to it again via <code>redis-cli</code>, I get the following error:</p>
<pre><code>$ redis-cli -h &lt;aws-elasticache-cluster-primary-endpoint&gt;
Could not connect to Redis at &lt;aws-elasticache-cluster-primary-endpoint&gt;:6379: Name or service not known
not connected&gt; 
</code></pre>
<p>I should be able to connect again with no issue. Why would I be getting DNS errors the next day when it worked initially? Nothing has changed about the cluster since I created it. How could I fix this?</p>
<h2>Steps to Reproduce</h2>
<ol>
<li><p>ElastiCache Dashboard -&gt; Redis -&gt; Create.</p>
</li>
<li><p>Set the following options:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Option</th>
<th style="text-align: left;">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Cluster Engine</td>
<td style="text-align: left;">Redis</td>
</tr>
<tr>
<td style="text-align: left;">Location</td>
<td style="text-align: left;">Amazon Cloud</td>
</tr>
<tr>
<td style="text-align: left;">Engine version compatibility</td>
<td style="text-align: left;">6.x</td>
</tr>
<tr>
<td style="text-align: left;">Port</td>
<td style="text-align: left;">6379</td>
</tr>
<tr>
<td style="text-align: left;">Parameter group</td>
<td style="text-align: left;">default.redis6.x</td>
</tr>
<tr>
<td style="text-align: left;">Node type</td>
<td style="text-align: left;">cache.t3.micro</td>
</tr>
<tr>
<td style="text-align: left;">Number of replicas</td>
<td style="text-align: left;">0</td>
</tr>
<tr>
<td style="text-align: left;">Multi-AZ</td>
<td style="text-align: left;">false</td>
</tr>
<tr>
<td style="text-align: left;">Subnet group</td>
<td style="text-align: left;">default</td>
</tr>
<tr>
<td style="text-align: left;">Security groups</td>
<td style="text-align: left;">default</td>
</tr>
<tr>
<td style="text-align: left;">Encryption at-rest</td>
<td style="text-align: left;">false</td>
</tr>
<tr>
<td style="text-align: left;">Encryption in-transit</td>
<td style="text-align: left;">false</td>
</tr>
</tbody>
</table>
</div></li>
<li><p>Create.</p>
</li>
<li><p>After creating, verify you can connect to the cluster with:</p>
<p><code>redis-cli -h &lt;aws-elasticache-cluster-primary-endpoint&gt;</code></p>
</li>
<li><p>Disconnect.</p>
</li>
<li><p>Try reconnecting with the same <code>redis-cli</code> command a few days later. You should see the errors shown in the section above.</p>
</li>
</ol>
<h2>Additional Information</h2>
<h3><code>nping</code></h3>
<pre><code>$ sudo nping --tcp -p 6379 &lt;aws-elasticache-cluster-primary-endpoint&gt;
Failed to resolve given hostname/IP: &lt;aws-elasticache-cluster-primary-endpoint&gt;.  Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges
Cannot find a valid target. Please make sure the specified hosts are either IP addresses in standard notation or hostnames that can be resolved with DNS
</code></pre>
<h3><code>nslookup</code></h3>
<pre><code>$ sudo nslookup &lt;aws-elasticache-cluster-primary-endpoint&gt;
Server:         75.75.75.75
Address:        75.75.75.75#53

** server can't find &lt;aws-elasticache-cluster-primary-endpoint&gt;: REFUSED
</code></pre>
<h3>Reachability Analyzer</h3>
<p>I followed <a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/TroubleshootingConnections.html#Connectivity" rel="nofollow noreferrer">AWS' instructions</a> for testing connectivity from my EC2 instance to the ElastiCache cluster. The results I got back for the connectivity were:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Reachability Status</th>
<th style="text-align: left;">State</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Reachable</td>
<td style="text-align: left;">Succeeded</td>
</tr>
</tbody>
</table>
</div><h3>Cluster Metrics</h3>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: left;">Metric</th>
<th style="text-align: right;">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">CPU Utilization</td>
<td style="text-align: right;">~1.000%</td>
</tr>
<tr>
<td style="text-align: left;">Engine CPU Utilization</td>
<td style="text-align: right;">~0.283%</td>
</tr>
<tr>
<td style="text-align: left;">Database Memory Usage Percentage</td>
<td style="text-align: right;">~1.093%</td>
</tr>
</tbody>
</table>
</div><h3>Local Wireguard configuration</h3>
<pre><code>[Interface]
PrivateKey = &lt;value&gt;
ListenPort = 21841
Address = 10.0.0.2/32
DNS = 9.9.9.9 # 75.75.75.75 75.75.76.76

[Peer]
PublicKey = &lt;value&gt;
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = &lt;public-IP&gt;:51820
</code></pre>

<amazon-web-services><vpn><redis>
AWS ElastiCache Redis DNS error - Name or service not known
Zachary Delano
# AWS ElastiCache Redis DNS error - Name or service not known

(Asked by: username_0 on 2021-03-22)

The Problem & The Question
I'm trying to create an AWS ElastiCache Redis-flavored cluster and connect to it from an instance in the same VPC. When I create the cluster initially, I can connect to it just fine via redis-cli. If I wait a day or two and then try to connect to it again via redis-cli, I get the following error:
$ redis-cli -h 
Could not connect to Redis at :6379: Name or service not known
not connected> 

I should be able to connect again with no issue. Why would I be getting DNS errors the next day when it worked initially? Nothing has changed about the cluster since I created it. How could I fix this?
Steps to Reproduce

ElastiCache Dashboard -> Redis -> Create.

Set the following options:




Option
Value




Cluster Engine
Redis


Location
Amazon Cloud


Engine version compatibility
6.x


Port
6379


Parameter group
default.redis6.x


Node type
cache.t3.micro


Number of replicas
0


Multi-AZ
false


Subnet group
default


Security groups
default


Encryption at-rest
false


Encryption in-transit
false




Create.

After creating, verify you can connect to the cluster with:
redis-cli -h 

Disconnect.

Try reconnecting with the same redis-cli command a few days later. You should see the errors shown in the section above.


Additional Information
nping
$ sudo nping --tcp -p 6379 
Failed to resolve given hostname/IP: .  Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges
Cannot find a valid target. Please make sure the specified hosts are either IP addresses in standard notation or hostnames that can be resolved with DNS

nslookup
$ sudo nslookup 
Server:         75.75.75.75
Address:        75.75.75.75#53

** server can't find : REFUSED

Reachability Analyzer
I followed AWS' instructions for testing connectivity from my EC2 instance to the ElastiCache cluster. The results I got back for the connectivity were:




Reachability Status
State




Reachable
Succeeded



Cluster Metrics




Metric
Value




CPU Utilization
~1.000%


Engine CPU Utilization
~0.283%


Database Memory Usage Percentage
~1.093%



Local Wireguard configuration
[Interface]
PrivateKey = 
ListenPort = 21841
Address = 10.0.0.2/32
DNS = 9.9.9.9 # 75.75.75.75 75.75.76.76

[Peer]
PublicKey = 
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = :51820

**Tags:** amazon-web-services, vpn, redis


---

## 1 answers

### Answer by username_1 on 2021-03-27. Score: 1

It could be due to a "VPC DNS throttling", you can find more information on the official documentation.

<https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-cause-of-failed-dns-queries/>

> **Comments:**
> **username_2**: It can also be an issue if the OP is using some form of third-party DNS resolver, such as Microsoft AD Domain Controller (i.e. if the environment relies on AD or LDAP).  Generally, public DNS services such as Google or Cloudflare are going to be good, but a misconfigured localdomain DNS host can cause tons of problems.  

---

