|
1 | 1 | --- |
2 | | -title: "Boto3 Retrier Configuration in Prowler" |
| 2 | +title: "Boto3 Retrier and Timeout Configuration in Prowler" |
3 | 3 | --- |
4 | 4 |
|
| 5 | +import { VersionBadge } from "/snippets/version-badge.mdx" |
| 6 | + |
5 | 7 | Prowler's AWS Provider leverages Boto3's [Standard](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html) retry mode to automatically retry client calls to AWS services when encountering errors or exceptions. |
6 | 8 |
|
| 9 | +## Timeout Configuration |
| 10 | + |
| 11 | +<VersionBadge version="5.42.0" /> |
| 12 | + |
| 13 | +Every AWS API call is bounded by two timeouts: |
| 14 | + |
| 15 | +- Connect timeout: seconds to wait to establish a connection (TCP, proxy tunnel and TLS handshake) to the AWS endpoint. Prowler's default is 10 seconds, configurable via `--aws-connect-timeout 5`. |
| 16 | +- Read timeout: seconds to wait for a response once connected. Prowler's default is 60 seconds, configurable via `--aws-read-timeout 30`. |
| 17 | + |
| 18 | +Both timeouts can also be set through environment variables, which is the way to tune them in Prowler Cloud and other deployments without a CLI: |
| 19 | + |
| 20 | +```console |
| 21 | +export PROWLER_AWS_BOTO3_CONNECT_TIMEOUT=5 |
| 22 | +export PROWLER_AWS_BOTO3_READ_TIMEOUT=30 |
| 23 | +``` |
| 24 | + |
| 25 | +CLI flags take precedence over the environment variables. Prowler sets both timeouts explicitly, so `AWS_DEFAULTS_MODE` and a `connect_timeout` in `~/.aws/config` are ignored; use the flag or the environment variable instead. |
| 26 | + |
| 27 | +<Note> |
| 28 | +Boto3 defaults both timeouts to 60 seconds. In networks with restricted egress (for example VPC endpoints for a subset of services, GovCloud or private deployments), every AWS service without a reachable endpoint used to cost up to 4 attempts × 60 seconds (the first call plus the 3 retries) for each region. Prowler lowers the connect timeout to 10 seconds so unreachable endpoints fail fast; lower it further together with `--aws-retries-max-attempts 0`, which disables retries and leaves a single attempt per call, if a scan still spends most of its time waiting on unreachable services. |
| 29 | + |
| 30 | +</Note> |
| 31 | + |
7 | 32 | ## Retry Behavior Overview |
8 | 33 |
|
9 | 34 | Boto3's Standard retry mode includes the following mechanisms: |
10 | 35 |
|
11 | | -- Maximum Retry Attempts: Default value set to 3, configurable via the `--aws-retries-max-attempts 5` argument. |
| 36 | +- Maximum Retry Attempts: Default value set to 3, configurable via the `--aws-retries-max-attempts 5` argument. `0` disables retries. |
12 | 37 |
|
13 | 38 | - Expanded Error Handling: Retries occur for a comprehensive set of errors. |
14 | 39 |
|
|
0 commit comments