Developer Guide

Retries and Timeouts

The AWS SDK for .NET allows you to configure the number of retries and the timeout values for HTTP requests to AWS services. If the default values for retries and timeouts are not appropriate for your application, you can adjust them for your specific requirements, but it is important to understand how doing so will affect the behavior of your application.

To determine which values to use for retries and timeouts, consider the following:

  • How should the AWS SDK for .NET and your application respond when network connectivity degrades or an AWS service is unreachable? Do you want the call to fail fast, or is it appropriate for the call to keep retrying on your behalf?

  • Is your application a user-facing application or website that must be responsive, or is it a background processing job that has more tolerance for increased latencies?

  • Is the application deployed on a reliable network with low latency, or it is deployed at a remote location with unreliable connectivity?


The AWS SDK for .NET will retry requests that fail due to server-side throttling or dropped connections. You can use the MaxErrorRetry property of the ClientConfig class to specify the number of retries at the service client level. the AWS SDK for .NET will retry the operation the specified number of times before failing and throwing an exception. By default, the MaxErrorRetry property is set to 4, except for the AmazonDynamoDBConfig class, which defaults to 10 retries. When a retry occurs, it increases the latency of your request. You should configure your retries based on your application limits for total request latency and error rates.


The AWS SDK for .NET allows you to configure the request timeout and socket read/write timeout values at the service client level. These values are specified in the Timeout and the ReadWriteTimeout properties of the ClientConfig class, respectively. These values are passed on as the Timeout and ReadWriteTimeout properties of the HttpWebRequest objects created by the AWS service client object. By default, the Timeout value is 100 seconds and the ReadWriteTimeout value is 300 seconds.

When your network has high latency, or conditions exist that cause an operation to be retried, using long timeout values and a high number of retries can cause some SDK operations to seem unresponsive.


The version of the AWS SDK for .NET that targets the portable class library (PCL) uses the HttpClient class instead of the HttpWebRequest class, and supports the Timeout property only.

The following are the exceptions to the default timeout values. These values are overridden when you explicitly set the timeout values.


The following example shows how to specify a maximum of 2 retries, a timeout of 10 seconds, and a read/write timeout of 10 seconds for an AmazonS3Client object.

var client = new AmazonS3Client( new AmazonS3Config { Timeout = TimeSpan.FromSeconds(10), // Default value is 100 seconds ReadWriteTimeout = TimeSpan.FromSeconds(10), // Default value is 300 seconds MaxErrorRetry = 2 // Default value is 4 retries });

On this page: