diff --git a/aws/aws.go b/aws/aws.go index f4a6dce45e..7d24254133 100644 --- a/aws/aws.go +++ b/aws/aws.go @@ -22,6 +22,9 @@ import ( "strconv" awsv2 "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/ratelimit" + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go-v2/config" awsv2cfg "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/client" @@ -251,5 +254,14 @@ func V2ConfigFromURLParams(ctx context.Context, q url.Values) (awsv2.Config, err opts = append(opts, awsv2cfg.WithEndpointResolverWithOptions(customResolver)) } + // SDK v2 adds client-side rate limiting: https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/retries-timeouts/#client-side-rate-limiting + // This can cause "failed to get rate limit token" errors. Disable this to restore + // the behavior of SDK v1. + opts = append(opts, config.WithRetryer(func() awsv2.Retryer { + return retry.NewStandard(func(o *retry.StandardOptions) { + o.RateLimiter = ratelimit.None + }) + })) + return awsv2cfg.LoadDefaultConfig(ctx, opts...) }