Architecture

ElastiCache AUTH Required: Configuring Redis Authentication Correctly

2026-05-20 · 8 min read

Your application was connecting to ElastiCache Redis just fine until someone enabled encryption in transit. Now every connection attempt fails with:

NOAUTH Authentication required.

Or you see this in your application logs:

Redis connection error: Error: NOAUTH Authentication required.
    at parseError (/app/node_modules/redis/lib/parser.js:179:12)

Or worse, the connection hangs silently and times out:

Redis connection error: connect ETIMEDOUT 10.0.1.42:6379

ElastiCache authentication errors are deceptive. The error messages look simple, but behind them lies a complex interaction between auth tokens, TLS configuration, security groups, VPC networking, and parameter group settings. I have debugged ElastiCache connectivity issues for dozens of clients, and the root cause is rarely what it first appears to be.

Here is my systematic approach to diagnosing and fixing every common ElastiCache authentication failure.

Step 1: Get the Current Cluster Configuration

Before making any changes, understand the current state of your ElastiCache setup:

# For replication groups (most common setup)
aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].{
    Status: Status,
    AuthTokenEnabled: AuthTokenEnabled,
    TransitEncryptionEnabled: TransitEncryptionEnabled,
    AtRestEncryptionEnabled: AtRestEncryptionEnabled,
    ClusterMode: ClusterEnabled,
    AutomaticFailover: AutomaticFailover,
    MemberClusters: MemberClusters,
    NodeGroups: NodeGroups[*].{
      PrimaryEndpoint: PrimaryEndpoint,
      ReaderEndpoint: ReaderEndpoint,
      NodeGroupMembers: NodeGroupMembers[*].{
        CacheClusterId: CacheClusterId,
        CurrentRole: CurrentRole
      }
    }
  }'

Pay close attention to AuthTokenEnabled and TransitEncryptionEnabled. If AuthTokenEnabled is true, every connection must provide the auth token. If TransitEncryptionEnabled is true, every connection must use TLS.

# Check the parameter group for additional settings
aws elasticache describe-cache-parameters \
  --cache-parameter-group-name my-redis-params \
  --query 'Parameters[?ParameterName==`cluster-enabled` || ParameterName==`maxmemory-policy`].{Name: ParameterName, Value: ParameterValue}'

Root Cause 1: AUTH Token Required but Not Provided

When AuthTokenEnabled is true, your client must send the AUTH command before any other command. The way you provide this depends on your client library.

For redis-cli testing:

# Without TLS (if transit encryption is disabled)
redis-cli -h my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com \
  -p 6379 \
  -a 'my-auth-token-here'

# With TLS (if transit encryption is enabled)
redis-cli -h my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com \
  -p 6379 \
  --tls \
  -a 'my-auth-token-here'

In application code, the auth token goes in the connection string or configuration:

redis://default:my-auth-token-here@my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com:6379

Or for TLS connections:

rediss://default:my-auth-token-here@my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com:6379

Note the double s in rediss:// — this indicates a TLS connection. Using redis:// when TLS is required will cause a connection failure.

A common mistake is storing the auth token in a configuration file or environment variable and accidentally including trailing whitespace or newline characters. Verify the exact value:

# Check for hidden characters in your env var
echo -n "$REDIS_AUTH_TOKEN" | xxd | tail -5

Root Cause 2: TLS Required but Client Not Configured

Enabling transit encryption changes the connection requirements fundamentally. Your client must use TLS, and the port may also change depending on your configuration.

Test TLS connectivity with openssl:

openssl s_client -connect \
  my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com:6379 \
  -servername my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com

If this fails with a connection refused or timeout, TLS is not enabled on the cluster, or you have a network-level issue. If it succeeds and shows certificate information, TLS is working and your application client needs to be configured accordingly.

For Node.js applications using ioredis:

const Redis = require('ioredis');
const client = new Redis({
  host: 'my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com',
  port: 6379,
  password: 'my-auth-token-here',
  tls: {} // This empty object enables TLS
});

The most common mistake I see is forgetting the tls: {} option. Without it, the client tries an unencrypted connection to a TLS-only port and gets a connection reset.

Root Cause 3: AUTH Token Rotation Issues

ElastiCache supports having two active auth tokens simultaneously during rotation. This allows zero-downtime token updates. However, if the rotation is not completed correctly, connections can fail.

The rotation process has specific steps:

# Step 1: Set the new auth token (both old and new work during this phase)
aws elasticache modify-replication-group \
  --replication-group-id my-redis-cluster \
  --auth-token 'new-auth-token-here' \
  --auth-token-update-strategy SET \
  --apply-immediately

# Step 2: Wait for the modification to complete
aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].Status'

# Step 3: Update all application instances to use the new token

# Step 4: Rotate to make only the new token valid
aws elasticache modify-replication-group \
  --replication-group-id my-redis-cluster \
  --auth-token 'new-auth-token-here' \
  --auth-token-update-strategy ROTATE \
  --apply-immediately

The critical mistake is running the ROTATE step before all application instances have been updated. Once you ROTATE, the old token stops working immediately. If any instance is still using the old token, it loses its connection.

Check pending modifications:

aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].PendingModifiedValues'

Root Cause 4: Security Group Not Allowing Port 6379

Even with correct authentication, if the security group blocks the connection, you will see timeouts instead of NOAUTH errors. This distinction is important for diagnosis.

# Find the security groups attached to the ElastiCache cluster
aws elasticache describe-cache-clusters \
  --cache-cluster-id my-redis-cluster-001 \
  --query 'CacheClusters[0].SecurityGroups'
# Check the security group rules
aws ec2 describe-security-groups \
  --group-ids sg-abc123 \
  --query 'SecurityGroups[0].IpPermissions[?FromPort==`6379`]'

The security group must allow inbound TCP on port 6379 from the security group or CIDR range of your application. A common issue after migration: the application moved to a new subnet or VPC, but the ElastiCache security group still references the old source.

# Add a rule to allow your application's security group
aws ec2 authorize-security-group-ingress \
  --group-id sg-elasticache-123 \
  --protocol tcp \
  --port 6379 \
  --source-group sg-application-456

Root Cause 5: Subnet Group in Wrong VPC

ElastiCache nodes are launched into subnets defined by the subnet group. If the subnet group is in a different VPC than your application, no connection is possible regardless of security group rules.

aws elasticache describe-cache-subnet-groups \
  --cache-subnet-group-name my-redis-subnet-group \
  --query 'CacheSubnetGroups[0].{
    VpcId: VpcId,
    Subnets: Subnets[*].{
      SubnetId: SubnetIdentifier,
      AZ: SubnetAvailabilityZone.Name
    }
  }'

Compare this VPC ID with your application's VPC. If they differ, you need to either move your application, create a new ElastiCache cluster in the correct VPC, or set up VPC peering.

Root Cause 6: Cluster Mode Connection Differences

ElastiCache cluster mode enabled (CME) and cluster mode disabled (CMD) require different client configurations. Using the wrong connection approach causes confusing failures.

For cluster mode disabled, connect to the primary endpoint:

aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].NodeGroups[0].PrimaryEndpoint'

For cluster mode enabled, you must use the configuration endpoint and a cluster-aware client:

aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].ConfigurationEndpoint'

Using a non-cluster-aware client with a cluster mode enabled endpoint results in MOVED or ASK errors:

(error) MOVED 5798 10.0.1.42:6379

This is not an authentication error, but it is commonly confused with one because the connection appears to fail.

Root Cause 7: Parameter Group Changes Requiring Reboot

Certain parameter changes do not take effect until the cluster nodes are rebooted. If you recently changed parameters related to authentication or networking, the old settings may still be active.

# Check for pending parameter changes
aws elasticache describe-cache-clusters \
  --cache-cluster-id my-redis-cluster-001 \
  --query 'CacheClusters[0].CacheParameterGroup.CacheParameterGroupName'

# Reboot a specific node to apply pending changes
aws elasticache reboot-cache-cluster \
  --cache-cluster-id my-redis-cluster-001 \
  --cache-node-ids-to-reboot 0001

Similarly, enabling transit encryption on an existing cluster requires the cluster to support in-place encryption migration. Not all engine versions support this. Check the modification status:

aws elasticache describe-replication-groups \
  --replication-group-id my-redis-cluster \
  --query 'ReplicationGroups[0].TransitEncryptionMode'

The value should be required after enabling. If it shows preferred, the cluster is in a transitional state where both TLS and non-TLS connections are accepted.

Root Cause 8: Redis ACL Users and Permissions

ElastiCache Redis 6.0 and later supports Redis ACLs, which add a user-level permission layer on top of auth tokens. If ACLs are configured, you need both the correct username and password.

aws elasticache describe-users \
  --query 'Users[*].{
    UserId: UserId,
    UserName: UserName,
    Status: Status,
    AccessString: AccessString,
    Engine: Engine
  }'
aws elasticache describe-user-groups \
  --query 'UserGroups[*].{
    UserGroupId: UserGroupId,
    Status: Status,
    UserIds: UserIds,
    ReplicationGroups: ReplicationGroups
  }'

If a user has a restrictive access string like ~app:* +@read, they can only access keys matching app:* and only read operations. Attempting a write will fail with a permission error that looks similar to an auth error.

Prevention and Best Practices

Store auth tokens in AWS Secrets Manager and rotate them automatically. Never hardcode tokens in application configurations.

Use the same security group reference pattern consistently. Instead of CIDR-based rules, reference the application security group so rules survive IP changes.

Test connectivity from within the VPC before deploying application changes. Use a bastion host or an EC2 instance in the same subnet:

# From a bastion host in the same VPC
redis-cli -h my-redis-cluster.abc123.ng.0001.use1.cache.amazonaws.com \
  -p 6379 --tls -a "$REDIS_AUTH_TOKEN" ping

Monitor authentication failures using ElastiCache CloudWatch metrics. The AuthenticationFailures metric spikes when clients send wrong tokens.

Document the transit encryption state of each cluster. Knowing whether TLS is required prevents hours of debugging when a new service is added.

Use the configuration endpoint for cluster mode enabled setups and ensure your client library supports Redis Cluster protocol.

When to Call for Help

ElastiCache connectivity problems that resist the above diagnosis usually involve VPC networking complexity — VPC peering routes, transit gateway configurations, or DNS resolution issues within private subnets. We regularly help teams design ElastiCache architectures that are secure, performant, and maintainable. If your Redis connectivity is unreliable or you are planning a migration to ElastiCache, reach out for a free consultation. We will review your network architecture and auth configuration to find the issue.

Need help with your AWS infrastructure?

Book a free 30-minute consultation to discuss your challenges.