title: Redis SSL configuration is not clear in case of SpringBoot with lettuce-core
body: <ul>
  <li>Spring-boot: 2.0.3.RELEASE </li>
  <li>lettuce-core: 5.0.4.RELEASE</li>
  <li>spring-data-redis: 2.0.8.RELEASE</li>
  </ul>
  
  <p><strong>So first of all my issue is solved I just don't understand why and it bothers me, so some clarification around this is appreciated.</strong> </p>
  
  <p>I have this Redis Configuration in one of the micro-service I'm working on:</p>
  
  <pre class="lang-java prettyprint-override"><code>import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  import io.lettuce.core.RedisClient;
  import io.lettuce.core.RedisURI;
  import io.lettuce.core.api.StatefulRedisConnection;
  import io.lettuce.core.resource.ClientResources;
  import io.lettuce.core.resource.DefaultClientResources;
  
  @Configuration
  public class LettuceConfig {
  
      @Bean(destroyMethod = "shutdown")
      ClientResources clientResources() {
          return DefaultClientResources.create();
      }
  
      @Bean(destroyMethod = "shutdown")
      RedisClient redisClient(ClientResources clientResources) {
          String host = System.getenv("spring_redis_host") != null ? System.getenv("spring_redis_host") : "127.0.0.1";
          String port = System.getenv("spring_redis_port") != null ? System.getenv("spring_redis_port") : "6379";
          String password = System.getenv("spring_redis_password") != null ? System.getenv("spring_redis_password") : "";
          Boolean isLocal = host.equals("127.0.0.1");
  
          RedisURI redisUri = RedisURI.Builder.redis(host).withSsl(!isLocal).withPassword(password).withPort(Integer.parseInt(port))
                  .build();
          return RedisClient.create(clientResources, redisUri);
      }
  
      @Bean(destroyMethod = "close")
      StatefulRedisConnection&lt;String, String&gt; connection(RedisClient redisClient) {
          return redisClient.connect();
      }
  }
  </code></pre>
  
  <p>After I added actuator to the project I realized that the service couldn't connect to the remote Redis in AWS and the service throwed the following Exception:</p>
  
  <pre><code>java.io.IOException: Connection reset by peer
  </code></pre>
  
  <p>After a quick google search most of the answers suggested that the problem is around the SSL connection I have, but I was confused since the RedisURI contains the <strong>withSsl</strong> function call.</p>
  
  <p>Just out of curiosity I added the following property to my application.properties file, since I'm using property based Redis configuration in the other services and I knew it works. </p>
  
  <pre><code>spring.redis.ssl=true
  </code></pre>
  
  <p>Now this solved my problem, but I don't understand why this approach is working and the RedisURI version is not.</p>
  
  <p><strong>Could somebody provide me an explanation, who has a clear understanding about the following situation please?</strong></p>
  
  <p>I can share more from the logs if needed. Thank you!</p>