Use redis-cli to connect to redis container from another aptible container?

I need to use a redis-cli command that is not present in the ruby-sdk. Its for mass insertion. However, when trying to connect to the redis container from within my app container, using redis-cli -a [PASSWORD] -h [HOST] -p [PORT], there is no output, and it just hangs. Is there anyway I can connect to my redis database using redis-cli from another container?

I get a “Could not connect to Redis at [HOST]:[PORT]: Connection timed out” error

Never mind, I figured it out lol. stupid mistake on my part

Glad you were able to sort things out @waleed-nexhealth! You might want to share what the problem was should others stumble on this hoping for a solution :wink:

1 Like

I was connecting to a production Redis db from a development instance lol.

For posterity for others, this article may help explain:

Each Aptible stack is on a separate VPC. Databases run in the VPC’s private subnet and are not accessible from the Internet (or another Aptible stack, for that matter). Trying to access a database from outside the stack will fail, because the database URL will not resolve properly.

1 Like