title: Connection to Encrypted ElastiCache Redis from Java using a CName
body: <p>I am using the Lettuce driver from spring data to connect to an ElastiCache using in transit encryption. When I try to connect to the Route53 CName assigned to the ElastiCache cluster. I get this error:</p>
  
  <pre><code>Caused by: com.lambdaworks.redis.RedisException: Cannot retrieve initial cluster partitions from initial URIs [RedisURI [host='my.cname.net', port=6379]]
      at com.lambdaworks.redis.cluster.RedisClusterClient.loadPartitions(RedisClusterClient.java:507)
      at com.lambdaworks.redis.cluster.RedisClusterClient.initializePartitions(RedisClusterClient.java:481)
      at com.lambdaworks.redis.cluster.RedisClusterClient.connectClusterAsyncImpl(RedisClusterClient.java:335)
      at com.lambdaworks.redis.cluster.RedisClusterClient.connectClusterAsync(RedisClusterClient.java:273)
      at org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.doGetAsyncDedicatedConnection(LettuceClusterConnection.java:1250)
      at org.springframework.data.redis.connection.lettuce.LettuceConnection.getAsyncDedicatedConnection(LettuceConnection.java:3466)
      at org.springframework.data.redis.connection.lettuce.LettuceConnection.getDedicatedConnection(LettuceConnection.java:3487)
      at org.springframework.data.redis.connection.lettuce.LettuceConnection.getConnection(LettuceConnection.java:3460)
      at org.springframework.data.redis.connection.lettuce.LettuceConnection.sMembers(LettuceConnection.java:1998)
      ... 24 common frames omitted
  </code></pre>
  
  <p>Here is the code I am using to connect:</p>
  
  <pre><code>@Bean
  public static RedisConnectionFactory connectionFactory() {
      Map&lt;String, Object&gt; source = Maps.newHashMap();
      source.put("spring.redis.cluster.nodes", "my.cname.net:6379");
      RedisClusterConfiguration clusterConfiguration = new RedisClusterConfiguration(new MapPropertySource("RedisClusterConfiguration", source));
      clusterConfiguration.setMaxRedirects(10);
      LettuceConnectionFactory factory = new LettuceConnectionFactory(clusterConfiguration);
      factory.setValidateConnection(false);
      factory.setUseSsl(true);
      return factory;
  }
  </code></pre>
  
  <p>Now when I replace the Cname with the acual network name attached to the ElastiCache cluster the program works. Does anyone know why the Program is failing only when using the Cname?</p>