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.

답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠