Skip to content

fix: add BackoffCredentialsProvider to mitigate STS throttling across all plugins#6637

Merged
dinujoh merged 1 commit into
opensearch-project:mainfrom
dinujoh:fix/sts-throttling-credentials-provider
Mar 13, 2026
Merged

fix: add BackoffCredentialsProvider to mitigate STS throttling across all plugins#6637
dinujoh merged 1 commit into
opensearch-project:mainfrom
dinujoh:fix/sts-throttling-credentials-provider

Conversation

@dinujoh

@dinujoh dinujoh commented Mar 13, 2026

Copy link
Copy Markdown
Member

Description

Wrap StsAssumeRoleCredentialsProvider with BackoffCredentialsProvider in CredentialsProviderFactory. When credential resolution fails (e.g. role deleted or trust policy misconfigured), the wrapper caches the failure and applies exponential backoff (10s to 10min) before retrying STS, preventing excessive AssumeRole calls that cause STS throttling.

This protects all plugins that use CredentialsProviderFactory including S3, OpenSearch, Lambda, SQS, and most AWS-integrated sources and sinks.

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

… all plugins

Wrap StsAssumeRoleCredentialsProvider with BackoffCredentialsProvider in
CredentialsProviderFactory. When credential resolution fails (e.g. role
deleted or trust policy misconfigured), the wrapper caches the failure
and applies exponential backoff (10s to 10min) before retrying STS,
preventing excessive AssumeRole calls that cause STS throttling.

This protects all plugins that use CredentialsProviderFactory including
S3, OpenSearch, Lambda, SQS, and most AWS-integrated sources and sinks.

Signed-off-by: Dinu John <86094133+dinujoh@users.noreply.github.com>
@dinujoh dinujoh force-pushed the fix/sts-throttling-credentials-provider branch from c105c4c to 1803a7f Compare March 13, 2026 18:54

@graytaylor0 graytaylor0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this will be a big improvement in STS call optimization.

@dlvenable dlvenable left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great approach. I have one comment about making it configurable.

class BackoffCredentialsProvider implements AwsCredentialsProvider {
private static final Logger LOG = LoggerFactory.getLogger(BackoffCredentialsProvider.class);

static final Duration INITIAL_BACKOFF = Duration.ofSeconds(10);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make these configurable in the aws plugin. Not configured per credential, but at the high level.

  aws:
    max_backoff: 10m
    configurations:
      default:
        sts_role_arn: arn:aws:iam::123456789012:role/MyRole
        region: us-east-2

@dinujoh dinujoh Mar 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should max_backoff be under  aws->configurations ?

aws:
  configurations:
    max_backoff: 10m
    default:
      sts_role_arn: ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I view configurations is to be essentially named configurations, so it would be a map. But, default is a special name. See #2570 for more detail.

So it should be directly under aws.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aws can have other plugins correct ? for example AwsSecretPlugin ?

@dlvenable dlvenable left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make this configurable in a follow on.

@dinujoh dinujoh merged commit 87f1154 into opensearch-project:main Mar 13, 2026
93 of 96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants