title: Lettuce - Java - AWS ElastiCache - Redis - Connection Timeout
body: <p>I am completely new to Redis and AWS ElastiCache service. I created a Redis cluster (5.0.6 v) with 1 Shard, 2 Nodes, No Encryption in-transit, No Encryption at-rest, No Redis Auth and Multi-AZ disabled.</p>
  <p>I could see Primary Endpoint, Reader Enpoint and clicking on cluster, could see 2 node endpoints different than primary and reader endpoints.</p>
  <p>I am using Lettuce with plain maven project to connect but getting Connection timeout. I tried with all combination of above endpoints no luck. I have added my ec2instance (where i am running code) to ElastiCache Subnet Groups. Still no luck.</p>
  <p>Code Used:</p>
  <pre><code>RedisClusterClient clusterClient = RedisClusterClient.create(Arrays.asList(node1, node2));
  StatefulRedisClusterConnection&lt;String, String&gt; connection = clusterClient.connect();
  RedisAdvancedClusterAsyncCommands&lt;String, String&gt; asyncCommands = connection.async();
  </code></pre>
  <p>pom (only dependency):</p>
  <pre><code> &lt;dependency&gt;
              &lt;groupId&gt;io.lettuce&lt;/groupId&gt;
              &lt;artifactId&gt;lettuce-core&lt;/artifactId&gt;
              &lt;version&gt;5.2.2.RELEASE&lt;/version&gt;
   &lt;/dependency&gt;
  </code></pre>
  <p><strong>I have use case with plain java-maven and no frameworks like spring boot</strong></p>
  <p>Appreciate for help.</p>