I am working on a Laravel application. I using Redis and I am using AWS ElasticCache service for that. I am trying to connect to the Redis from my Laravel application. But it is timing out. This is what I have done.
I installed the Predis library by running the following command.
composer require predis/predis
Then I created a Redis instance in the ElastiCache service console enabling AUTH setting my password token.
Then I set the variables in the .env files.
CACHE_DRIVER=redis
REDIS_CLIENT=predis
REDIS_HOST=master.laravelredistest.8sm3xo.euw1.cache.amazonaws.com
REDIS_PASSWORD=mypassword
REDIS_PORT=6379
When I run the code to connect to the Redis, I got the following error.
Operation timed out [tcp://master.laravelredistest.8sm3xo.euw1.cache.amazonaws.com:6379]
What is missing with my configuration and how can I fix it?
I also updated the security group of Redis to allow the EC2 instance's security group in the inbound rules as follows:
I am getting this error this time:
I edited the SG of Redis to add the following inbound rule too.
The security groups are in the same VPC too as you can see in the screenshot:



