feat: support default role assumers #2179
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Resolves #2087
Resolves #1998
Resolves #2011
Resolves #1193
Description
This change provides default role assumer for the default credentials provider that calls
sts:assumeRole
orsts:assumeRoleWithWebIdentity
under the hood. As a result, users don't need to import STS client and supply their own role assumer(like mentioned in #1193).These assumer is exported from STS client not the
packages/
folder because it can avoid circular dependency. Thecredential-provider-*
packages having any dependency over STS client will cause the same issue. As a result this change makes the source code comply the contract thatclients/
depends onpackages/
;lib/
depends onpackages/
andclients/
.Testing
✅ It has been manually tested with credential files containing assume role chaining
✅ It has been validate with bundler(Webpack) that tree shaking work well
Additional context
The example Lambda function size after tree shaking using default configure shows an increase from 115KB to 190KB because the base client now has dependencies over STS client
This change will add some overhead to lambda cold start performance whereas warm start performance is not changed. Here's a typical load test result(10K request, 500 concurrency). The lattency increases about 1~5%
Lambda invoke with 1 DyanmoDB call. Webpack; v3.9.0
Lambda invoke with 1 DyanmoDB call. Webpack; local-released
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.