Retry behavior in AWS CLI determines how commands respond to throttling, transient HTTP failures, and short-lived connection errors. Saving the correct mode in the active profile keeps routine terminal work and automation from inheriting stale retry behavior from an old workstation setup or a temporary shell override.
The setting is stored as retry_mode in the shared AWS configuration file and is read per profile. aws configure set writes the value into [default] or a named [profile NAME] block, while aws configure get reads the saved value back from the config file without making an AWS API call.
Current AWS documentation recommends standard and uses it as the default mode in AWS CLI v2, while legacy keeps the older retry handler and adaptive remains experimental while adding client-side rate limiting for specialized workloads. A saved profile value can still be overridden at runtime by AWS_RETRY_MODE in the current shell, so the persistent config value and the active session behavior need to be checked separately.
| Retry mode | Best fit | Default total attempts | Notes |
|---|---|---|---|
| standard | Daily CLI use and most automation | 3 | Recommended in current AWS documentation and the default for AWS CLI v2 |
| legacy | Compatibility with older retry behavior | 5 | Older retry handler with narrower retry coverage |
| adaptive | Specialized clients that need local rate limiting as well as retries | 3 | Experimental mode that can delay even the first request attempt |
If max_attempts is already set in the same profile, that explicit value still controls the total attempt count regardless of the selected retry_mode.
$ aws configure set retry_mode standard
This writes
retry_mode = standard
under the
[default]
section in ~/.aws/config.
$ aws configure set retry_mode adaptive --profile batch
adaptive mode is experimental in current AWS documentation and is intended for specialized client designs, so keep standard as the normal choice unless client-side rate limiting is required on purpose.
$ aws configure get retry_mode standard $ aws configure get retry_mode --profile batch adaptive
aws configure get reads the saved config value only, which makes it useful for confirming what is on disk before runtime overrides are considered.
$ cat ~/.aws/config [default] retry_mode = standard [profile batch] retry_mode = adaptive
retry_mode belongs in ~/.aws/config rather than ~/.aws/credentials. On Windows, the matching file is
%UserProfile%\.aws\config
.
Related: How to find the AWS CLI config file
$ printenv AWS_RETRY_MODE legacy $ unset AWS_RETRY_MODE
No output from
printenv AWS_RETRY_MODE
means no shell-level retry-mode override is active. The exported variable changes runtime behavior even though aws configure get retry_mode still reports the saved on-disk value.