Cannot connect to Elasticache through ECS (rust) (solved)

0

Edit: Figured this out. Had to replace "redis://" with "rediss://" to use TLS, and had to enable the feature on the package in my Cargo.toml. Maybe this will help someone else out.

I'm using Elasticache serverless and attempting to connect through the redis rust package.

The connection URL I'm using is redis://[elasticache endpoint uri]:6379.

I keep getting Multiplexed connection driver unexpectedly terminated- IoError when attempting to connect to redis upon deploying in ECS.

I have a Security Group set up with the ports 6379:6380 open for inbound traffic, and I made a fresh VPC to deploy this project.

Seems like I've tried every configuration and it's still not working. I've tried allowing all traffic on both SGs, still doesn't connect.

Any ideas on what to check or try would be helpful.

use redis::Client;

use crate::utilities::constants::get_env_var;

pub async fn initialize_client() -> redis::aio::MultiplexedConnection {
    println!("🚀       Redis initializing...");
    let client =
        Client::open(get_env_var("REDIS_CONNECTION_URL")).expect("Failed to create Redis client");
    // print connection url
    println!("🚀       Redis connection url: {}", get_env_var("REDIS_CONNECTION_URL"));
    let con = client
        .get_multiplexed_async_connection()
        .await
        .expect("Failed to connect to Redis");

    println!("🚀       Redis Client Initialized");

    con
}

This is the code I'm using to connect.

Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions