diff --git a/lib/ProviderAws.js b/lib/ProviderAws.js index 42717f0dd..0c499223b 100644 --- a/lib/ProviderAws.js +++ b/lib/ProviderAws.js @@ -24,6 +24,10 @@ module.exports = function(S) { this._config = config || {}; this.sdk = AWS; // We recommend you use the "request" method instead + // set retry delay to mitigate AWS API calls rate limits + // + AWS.config.update({retryDelayOptions: {base: 300}}); + // Use HTTPS Proxy (Optional) let proxy = process.env.proxy || process.env.HTTP_PROXY || process.env.http_proxy || process.env.HTTPS_PROXY || process.env.https_proxy; if (proxy) { @@ -39,6 +43,12 @@ module.exports = function(S) { AWS.config.httpOptions.timeout = parseInt(timeout, 10); } + // Configure the AWS Retry Delay to mitigate AWS API calls rate limits + let retryDelay = process.env.AWS_RETRY_DELAY || process.env.aws_retry_delay; + if (retryDelay) { + AWS.config.update({retryDelayOptions: {base: retryDelay}}); + } + // Detect Profile Prefix. Useful for multiple projects (e.g., myproject_prod) this._config.profilePrefix = process.env['AWS_PROFILE_PREFIX'] ? process.env['AWS_PROFILE_PREFIX'] : null; if (this._config.profilePrefix && this._config.profilePrefix.charAt(this._config.profilePrefix.length - 1) !== '_') {