Issue connecting to AWS Elasticache which is encrypted (Encryption at-rest/in-transit). I am using dotnet core

Viewed 306

I am connecting to Redis (hosted in aws elasticache) with encryption enabled (both in-transit and at-rest). I am using dotnet core 3.1 and AWS Lambda using StackExchange.Redis.

The following is the code used

services.AddDistributedRedisCache(options =>
        {
            options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions { 
                AbortOnConnectFail = false, 
                EndPoints = { { Environment.GetEnvironmentVariable("Elasticache"), 6379 } },
                Ssl = true
            };
        });

I get the following error

No connection is available to service this operation: EVAL; UnableToConnect on :6379/Interactive, origin: ResetNonConnected, input-buffer: 0, outstanding: 0, last-read: 5s ago, last-write: 5s ago, unanswered-write: 68639s ago, keep-alive: 60s, pending: 0, state: Connecting, last-heartbeat: never, last-mbeat: -1s ago, global: 5s ago, mgr: Inactive, err: never; IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=0,Free=2047,Min=4,Max=2047), Local-CPU: n/a at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisDatabase.ScriptEvaluate(String script, RedisKey[] keys, RedisValue[] values, CommandFlags flags) at Microsoft.Extensions.Caching.Redis.RedisCache.Set(String key, Byte[] value, DistributedCacheEntryOptions options)

If I create elasticache without encryption, the above code works fine (I remove the statement ssl=true). But the requirement is to make it work when it is encrypted.

0 Answers
Related