Developer Guide

This documentation is for version 2.0 of the AWS SDK for .NET. For the latest version, see the AWS SDK for .NET Developer Guide for version 3.

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 the SDK 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 the SDK 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 the SDK 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 the SDK 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 net-api-v2:ClientConfig <TRuntimeClientConfigNET45> 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 the SDK 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. Timeout and ReadWriteTimeout are set to the maximum values if the method being called uploads a stream, such as AmazonS3Client.PutObject(), AmazonS3Client.UploadPart(), AmazonGlacierClient.UploadArchive(), and so on. The version of the the SDK that targets the .NET Framework 4.5 sets Timeout and ReadWriteTimeout to the maximum values for all AmazonS3Client and AmazonGlacierClient objects. The version of the the SDK that targets the portable class library (PCL) sets Timeout to the maximum value for all AmazonS3Client and AmazonGlacierClient objects.


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