It should be possible to add timeout settings per API call. Please also document how to best handle timeouts globally for all AWS SDK API calls.
This is now supported by either globally setting:
AWS.Config.httpOptions = {timeout: 5000};
Or per-service:
s3 = new AWS.S3({httpOptions: {timeout: 5000}});
Note that all timeout values are in milliseconds.
Suppose the download takes longer than 5000 ms, does the connection get aborted? It doesn't seem to work that way. Is there a way to do that?
I agree with @syahmeds, I'm doing a test, setting the timeout to 1ms, but it takes anywhere from 10-20 seconds to get a "Connection timed out after 1ms" message back. It would be nice if the connection gets aborted when the timeout is reached, or if httpOptions.timeout is not the proper way to get the connection terminated, is there another option I'm not seeing that does abort the connection?
We identified these delays in the retry logic and not in the http session. Setting "maxRetries: 1" as a test should result in the behavior expected. Docs here
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
This is now supported by either globally setting:
Or per-service:
Note that all timeout values are in milliseconds.