AWS Security ChangesHomeSearch

AWS AmazonElastiCache documentation change

Service: AmazonElastiCache · 2026-07-04 · Documentation high

File: AmazonElastiCache/latest/dg/BestPractices.Clients.Redis.Discovery.md

Summary

Updated redis-py client retry mechanism documentation to reflect built-in exponential backoff support and added SSL configuration example

Security assessment

The change adds 'ssl=True' to the Redis client configuration example, enabling encryption in transit. This improves security documentation but doesn't address a specific vulnerability. No evidence of a security incident is mentioned.

Diff

diff --git a/AmazonElastiCache/latest/dg/BestPractices.Clients.Redis.Discovery.md b/AmazonElastiCache/latest/dg/BestPractices.Clients.Redis.Discovery.md
index 076f0a50c..05e911e0a 100644
--- a//AmazonElastiCache/latest/dg/BestPractices.Clients.Redis.Discovery.md
+++ b//AmazonElastiCache/latest/dg/BestPractices.Clients.Redis.Discovery.md
@@ -39 +39 @@ The following are some code examples for exponential backoff retry logic in redi
-redis-py has a built-in retry mechanism that retries one time immediately after a failure. This mechanism can be enabled through the `retry_on_timeout` argument supplied when creating a [Redis OSS](https://redis.readthedocs.io/en/stable/examples/connection_examples.html#redis.Redis) object. Here we demonstrate a custom retry mechanism with exponential backoff and jitter. We've submitted a pull request to natively implement exponential backoff in [redis-py (#1494)](https://github.com/andymccurdy/redis-py/pull/1494). In the future it may not be necessary to implement manually.
+redis-py has a built-in retry mechanism that supports exponential backoff with jitter. If no `retry` parameter is provided, redis-py defaults to `ExponentialWithJitterBackoff` with 3 retries. You can customize the retry behavior through the `retry` and `retry_on_error` arguments when creating a [Redis](https://redis.readthedocs.io/en/stable/retry.html) client.
@@ -42,14 +42,4 @@ redis-py has a built-in retry mechanism that retries one time immediately after
-    def run_with_backoff(function, retries=5):
-    base_backoff = 0.1 # base 100ms backoff
-    max_backoff = 10 # sleep for maximum 10 seconds
-    tries = 0
-    while True:
-    try:
-      return function()
-    except (ConnectionError, TimeoutError):
-      if tries >= retries:
-    	raise
-      backoff = min(max_backoff, base_backoff * (pow(2, tries) + random.random()))
-      print(f"sleeping for {backoff:.2f}s")
-      sleep(backoff)
-      tries += 1
+    from redis.backoff import ExponentialBackoff
+    from redis.retry import Retry
+    from redis.client import Redis
+    from redis.exceptions import ConnectionError, TimeoutError, BusyLoadingError
@@ -57 +47,2 @@ redis-py has a built-in retry mechanism that retries one time immediately after
-You can then use the following code to set a value:
+    # Run 3 retries with exponential backoff strategy
+    retry = Retry(ExponentialBackoff(), 3)
@@ -58,0 +50,8 @@ You can then use the following code to set a value:
+    # Redis client with retries
+    client = Redis(
+        host="clustercfg.my-cluster.us-east-1.cache.amazonaws.com",
+        port=6379,
+        retry=retry,
+        retry_on_error=[BusyLoadingError, ConnectionError, TimeoutError],
+        ssl=True
+    )
@@ -60,5 +59 @@ You can then use the following code to set a value:
-    client = redis.Redis(connection_pool=redis.BlockingConnectionPool(host=HOST, max_connections=10))
-    res = run_with_backoff(lambda: client.set("key", "value"))
-    print(res)
-
-Depending on your workload, you might want to change the base backoff value from 1 second to a few tens or hundreds of milliseconds for latency-sensitive workloads.
+For more information about retry configuration options, see [Retry Helpers](https://redis.readthedocs.io/en/stable/retry.html) in the redis-py documentation.