Omorinsola Mustapha
Omorinsola Mustapha

Reputation: 1

Unable to connect to ElastiCache Redis Serverless from Spring Boot Application

I have set up an ElastiCache Redis Serverless instance on AWS, and its status is "available". However, I am unable to establish a connection to it from my Spring Boot application. When attempting to connect, I encounter the following error message:

Unable to connect to seerbitbackend-9fekty.serverless.euw2.cache.amazonaws.com/<unresolved>:6379

Security Group Configuration:

Inbound Rule: Type: Custom TCP Rule Protocol: TCP Port Range: 6379 Source: 0.0.0.0/0 (allowing all inbound traffic on port 6379)

The ElastiCache instance is deployed in eu-west-2 (EU-WEST-2) region. The Spring Boot application uses standard Redis client libraries to connect (spring-boot-starter-data-redis).

What could be causing this issue, and what further steps should I take to diagnose and resolve the connection problem to my ElastiCache Redis Serverless instance?

Thank you

Upvotes: 0

Views: 1652

Answers (1)

Donghui.Im
Donghui.Im

Reputation: 1

Recently, I experienced a similar issue. I solved the issue by checking these two things:

1. Is AmazonElastiCacheFullAccess Policy Permitted for EC2 IAM Role?

According to the ElastiCache documentation, the AmazonElastiCacheFullAccess policy is required to use ElastiCache Serverless. (https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/set-up.html#elasticache-set-up-permissions)

2. Enable TLS for Spring Boot Data Redis

In order to use ElastiCache Serverless, TLS must be enabled. Therefore, set the spring.data.redis.ssl.enabled option to true in your Spring Boot configuration.(https://docs.spring.io/spring-boot/appendix/application-properties/index.html#application-properties.data.spring.data.redis.ssl.enabled)

It is important to have build support for TLS when installing redis-cli. ElastiCache Serverless is only accessible when TLS is enabled.

Upvotes: 0

Related Questions